home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / libs / SSLib51.lha / SSLib.doc < prev    next >
Text File  |  1995-01-16  |  82KB  |  3,050 lines

  1. TABLE OF CONTENTS
  2.  
  3. ss.library/AddExtension
  4. ss.library/AddHashItem
  5. ss.library/BFlush
  6. ss.library/BGetByte
  7. ss.library/BGetLong
  8. ss.library/BGets
  9. ss.library/BGetString
  10. ss.library/BGetWord
  11. ss.library/BPrintf
  12. ss.library/BPutByte
  13. ss.library/BPutChar
  14. ss.library/BPutLong
  15. ss.library/BPuts
  16. ss.library/BPutsNL
  17. ss.library/BPutString
  18. ss.library/BPutWord
  19. ss.library/BRead
  20. ss.library/BRelSeek
  21. ss.library/BSeek
  22. ss.library/BTell
  23. ss.library/BUnGetc
  24. ss.library/BWrite
  25. ss.library/CallBlock
  26. ss.library/ChkDoIO
  27. ss.library/ChkRead
  28. ss.library/ChkTryRead
  29. ss.library/ChkWrite
  30. ss.library/CreateResList
  31. ss.library/DisplayError
  32. ss.library/DosError
  33. ss.library/ExitCleanup
  34. ss.library/ExitError
  35. ss.library/FindHashItem
  36. ss.library/FormatStr
  37. ss.library/FreeAllResLists
  38. ss.library/FreeObject
  39. ss.library/FreeResList
  40. ss.library/GetExtension
  41. ss.library/GetResList
  42. ss.library/InitHashTree
  43. ss.library/IPAlloc
  44. ss.library/IPFree
  45. ss.library/LinearAlloc
  46. ss.library/LinearAllocN
  47. ss.library/LoadFile
  48. ss.library/MergeResLists
  49. ss.library/ParseArgs
  50. ss.library/PoolAlloc
  51. ss.library/PoolFree
  52. ss.library/Printf
  53. ss.library/Puts
  54. ss.library/PutsNL
  55. ss.library/QuickSort
  56. ss.library/RelinkObject
  57. ss.library/RemExtension
  58. ss.library/ReportError
  59. ss.library/SetExtension
  60. ss.library/SimpleRequest
  61. ss.library/SortList
  62. ss.library/SortListName
  63. ss.library/SortLongs
  64. ss.library/SortStrings
  65. ss.library/StartupInit
  66. ss.library/StrCat
  67. ss.library/StrToL
  68. ss.library/TestBreak
  69. ss.library/TestStack
  70. ss.library/TrackAlloc
  71. ss.library/TrackAllocMem
  72. ss.library/TrackAllocPub
  73. ss.library/TrackBufHandle
  74. ss.library/TrackDevice
  75. ss.library/TrackDosObject
  76. ss.library/TrackExtd
  77. ss.library/TrackIoRq
  78. ss.library/TrackLibrary
  79. ss.library/TrackLinPool
  80. ss.library/TrackLock
  81. ss.library/TrackObject
  82. ss.library/TrackOpen
  83. ss.library/TrackOpenBuf
  84. ss.library/TrackOpenBufFH
  85. ss.library/TrackPool
  86. ss.library/TrackPort
  87. ss.library/TrackRoutine
  88. ss.library/TrackSignal
  89. ss.library/TrackSlave
  90. ss.library/AddExtension                   ss.library/AddExtension
  91.  
  92.    NAME
  93.     AddExtension -- Add extension to file name.
  94.  
  95.    SYNOPSIS
  96.     Success = AddExtension(Name, Buffer, Extension, BufSize);
  97.     D0               A0    A1      A2     D0
  98.  
  99.    FUNCTION
  100.     Appends an extension to file name.  If there's already some extension
  101.     at the end of the name, nothing happens.
  102.  
  103.    INPUTS
  104.     Name - original file name
  105.  
  106.     Buffer - buffer to copy the result to
  107.  
  108.     Extension - extension to be added
  109.  
  110.     BufSize - size of the buffer
  111.  
  112.    RESULT
  113.     Success - TRUE if successful, FALSE if buffer overflow.
  114.  
  115.    SEE ALSO
  116.     SetExtension, GetExtension, RemExtension
  117.  
  118. ss.library/AddHashItem                       ss.library/AddHashItem
  119.  
  120.    NAME
  121.     AddHashItem -- Add item to hashed tree.
  122.  
  123.    SYNOPSIS
  124.     UserData = AddHashItem(Tree, ItemName, DataSize);
  125.     D0               A0    A1        D0
  126.  
  127.    FUNCTION
  128.     Add an item to hashed tree performing no checking of duplicity (if
  129.     you make duplicated entries, some of them will be lost and cannot be
  130.     found by any method, but are correctly freed if you free the tree).
  131.  
  132.     The item contains your own data area of specified size, which is
  133.     guaranteed to be filled by zeroes.
  134.  
  135.    INPUTS
  136.     Tree - hashed tree represented by its tracker
  137.  
  138.     ItemName - text key representing the item
  139.  
  140.     DataSize - the size of your data area for the item (0-32766, must be
  141.         even!)
  142.  
  143.    RESULT
  144.     UserData - Pointer to user data area of the item.  This data area is
  145.         preceeded by one word containing size of the area.  The area
  146.         is succeeded by key string.
  147.  
  148.    SEE ALSO
  149.     InitHashTree, FindHashItem, FreeObject
  150.  
  151. ss.library/BFlush                        ss.library/BFlush
  152.  
  153.    NAME
  154.     BFlush -- Flush a buffered stream
  155.  
  156.    SYNOPSIS
  157.     BFlush(Stream);
  158.            A2
  159.  
  160.    FUNCTION
  161.     Flush all information stored in stream buffers.  If it's a read
  162.     stream, buffered bytes are simply forgotten and the file is seeked to
  163.     reflect new position if needed.  If it's a write stream, the buffer
  164.     is simply written to the file.
  165.  
  166.    INPUTS
  167.     Stream - I/O stream tracker
  168.  
  169.    SEE ALSO
  170.     TrackOpenBuf, TrackOpenBufFH, TrackBufHandle
  171.  
  172. ss.library/BGetByte                      ss.library/BGetByte
  173.  
  174.    NAME
  175.     BGetByte -- Get one byte from buffered I/O stream
  176.  
  177.    SYNOPSIS
  178.     Byte = BGetByte(Stream);
  179.     D0        A2
  180.  
  181.    FUNCTION
  182.     Get one byte from buffered I/O stream opened for reading.  If there
  183.     are no more bytes available, returns -1 as an EOF mark.  (it's
  184.     possible to check this as a negative result, because it's the only
  185.     negative result given)
  186.  
  187.     The biob_eof bit is set if EOF has been encountered.
  188.  
  189.    INPUTS
  190.     Stream - I/O stream handle
  191.  
  192.    RESULT
  193.     Byte - byte got (extended to unsigned longword) or -1 if EOF.
  194.  
  195.    NOTE
  196.     This call modifies only A0 and D0.  A6 is not required to contain
  197.     SSLib base.
  198.  
  199.     This function can be easily inlined as:
  200.  
  201.         move.l    bh_current(A2),A0
  202.         cmp.l    bh_dataend(A2),A0
  203.         beq.s    .over
  204.         moveq    #0,D0
  205.         move.b    (A0)+,D0
  206.         move.l    A0,bh_current(A2)
  207.         bra.s    .okay
  208.     .over    call    ss,BGetByte
  209.     .okay
  210.  
  211.    SEE ALSO
  212.     TrackOpenBuf, TrackBufHandle, BGetWord, BGetLong, BPutByte, BPutChar
  213.  
  214. ss.library/BGetLong                      ss.library/BGetLong
  215.  
  216.    NAME
  217.     BGetLong -- Get one longword from buffered I/O stream
  218.  
  219.    SYNOPSIS
  220.     Long, EOF = BGetLong(Stream);
  221.     D0    D1         A2
  222.  
  223.    FUNCTION
  224.     Get one longword from buffered I/O stream opened for reading.  If
  225.     there are no more longwords available, returns EOF=-1 (it's possible
  226.     to check this as a negative result, because it's the only negative
  227.     result given)
  228.  
  229.     If it isn't possible to fetch the whole longword, EOF is returned and
  230.     the remaining 1-3 bytes are left in the buffer.
  231.  
  232.     The biob_eof bit is set if EOF has been encountered, but not if
  233.     several bytes remain and EOF has been signalled via result.
  234.  
  235.    INPUTS
  236.     Stream - I/O stream handle
  237.  
  238.    RESULT
  239.     Long - longword got (or -1 if EOF)
  240.  
  241.     EOF (D1) - set to -1 if EOF (less than 4 bytes available).  In other
  242.         cases zero.
  243.  
  244.    NOTE
  245.     This call modifies only A0 and D0/D1.  A6 is not required to contain
  246.     SSLib base.
  247.  
  248.    SEE ALSO
  249.     TrackOpenBuf, TrackBufHandle, BGetByte, BGetWord, BPutLong
  250.  
  251. ss.library/BGets                         ss.library/BGets
  252.  
  253.    NAME
  254.     BGets -- Get an EOL-terminated string
  255.  
  256.    SYNOPSIS
  257.     Success = BGets(Buffer, Size, Stream);
  258.     D0        A0    D0    A2
  259.  
  260.    FUNCTION
  261.     Read an EOL-terminated string into user-supplied buffer of specified
  262.     size.  When the string doesn't fit in the buffer, the buffer overflow
  263.     error (err_over) is reported and program execution is stopped if the
  264.     corresponding error bit is active.  Even in this case, the partial
  265.     string stored in the buffer is guaranteed to be null-terminated.
  266.  
  267.     When EOF is encountered in the middle of some string, the already
  268.     read part of the string is terminated by zero and EOF is returned.
  269.  
  270.    INPUTS
  271.     Buffer - buffer to read the string to
  272.  
  273.     Size - buffer size (1<Size<65536)
  274.  
  275.     Stream - I/O stream handle
  276.  
  277.    RESULT
  278.     Success - 0 if buffer overflow, 1 if string read OK, -1 if EOF
  279.  
  280.    NOTE
  281.     The EOL character itself is NOT stored into the buffer.
  282.  
  283.     NUL character is also recognised as an EOL.
  284.  
  285.    SEE ALSO
  286.     BGetString, BPuts, BPutsNL
  287.  
  288. ss.library/BGetString                    ss.library/BGetString
  289.  
  290.    NAME
  291.     BGetString -- Get a null-terminated string
  292.  
  293.    SYNOPSIS
  294.     Success = BGetString(Buffer, Size, Stream);
  295.     D0             A0      D0    A2
  296.  
  297.    FUNCTION
  298.     Read a null-terminated string into user-supplied buffer of specified
  299.     size.  When the string doesn't fit in the buffer, the buffer overflow
  300.     error (err_over) is reported and program execution is stopped if the
  301.     corresponding error bit is active.  Even in this case, the partial
  302.     string stored in the buffer is guaranteed to be null-terminated.
  303.  
  304.     When EOF is encountered in the middle of some string, the already
  305.     read part of the string is terminated by zero and EOF is returned.
  306.  
  307.    INPUTS
  308.     Buffer - buffer to read the string to
  309.  
  310.     Size - buffer size (1<Size<65536)
  311.  
  312.     Stream - I/O stream handle
  313.  
  314.    RESULT
  315.     Success - 0 if buffer overflow, 1 if string read OK, -1 if EOF
  316.  
  317.    SEE ALSO
  318.     BGets, BPutString
  319.  
  320. ss.library/BGetWord                      ss.library/BGetWord
  321.  
  322.    NAME
  323.     BGetWord -- Get one word from buffered I/O stream
  324.  
  325.    SYNOPSIS
  326.     Word = BGetWord(Stream);
  327.     D0        A2
  328.  
  329.    FUNCTION
  330.     Get one word from buffered I/O stream opened for reading.  If there
  331.     are no more words available, returns -1 as an EOF mark.  (it's
  332.     possible to check this as a negative result, because it's the only
  333.     negative result given)
  334.  
  335.     If it isn't possible to fetch the whole word, EOF is returned and the
  336.     remaining byte is left in the buffer.
  337.  
  338.     The biob_eof bit is set if EOF has been encountered, but not if one
  339.     byte remains and EOF has been signalled via result.
  340.  
  341.    INPUTS
  342.     Stream - I/O stream handle
  343.  
  344.    RESULT
  345.     Word - word got (extended to unsigned longword) or -1 if EOF.
  346.  
  347.    NOTE
  348.     This call modifies only A0 and D0.  A6 is not required to contain
  349.     SSLib base.
  350.  
  351.    SEE ALSO
  352.     TrackOpenBuf, TrackBufHandle, BGetByte, BGetLong, BPutWord
  353.  
  354. ss.library/BPrintf                       ss.library/BPrintf
  355.  
  356.    NAME
  357.     BPrintf -- Printf to buffered I/O stream
  358.  
  359.    SYNOPSIS
  360.     BPrintf(Text, Params, Stream);
  361.         A0    A1      A3
  362.  
  363.    FUNCTION
  364.     Calls a RawDoFmt with PutChProc = BPutChar doing formatted output to
  365.     buffered I/O stream.
  366.  
  367.    INPUTS
  368.     Text - pointer to format string
  369.  
  370.     Params - pointer to parameter array
  371.  
  372.     Stream - I/O stream handle
  373.  
  374.    SEE ALSO
  375.     BPuts, BPutsNL, Printf, exec.library/RawDoFmt
  376.  
  377. ss.library/BPutByte                      ss.library/BPutByte
  378.  
  379.    NAME
  380.     BPutByte -- Put one byte to buffered stream
  381.  
  382.    SYNOPSIS
  383.     BPutByte(Byte, Stream);
  384.          D0.B  A3
  385.  
  386.    FUNCTION
  387.     Put one byte to buffered I/O stream opened for writing.
  388.  
  389.     This function should be used for writing of streams which don't have
  390.     the line buffering mode set, because it contains no checks for line
  391.     end characters.
  392.  
  393.    INPUTS
  394.     Byte - byte to be written
  395.  
  396.     Stream - I/O stream handle
  397.  
  398.    NOTE
  399.     This call modifies only A0.  A6 is not required to contain SSLib
  400.     base.  A5 can also contain illegal values, which makes this function
  401.     suitable for calling from non-SS environments.
  402.  
  403.     Can be inlined easily as:
  404.  
  405.         move.l    bh_current(A3),A0
  406.         cmp.l    bh_bufend(A3),A0
  407.         beq.s    .over
  408.         move.b    D0,(A0)+
  409.         move.l    A0,bh_current(A3)
  410.         bra.s    .okay
  411.     .over    call    ss,BPutByte
  412.     .okay
  413.  
  414.    SEE ALSO
  415.     TrackOpenBuf, TrackBufHandle, BPutWord, BPutLong, BGetByte, BPutChar
  416.  
  417. ss.library/BPutChar                      ss.library/BPutChar
  418.  
  419.    NAME
  420.     BPutChar -- Put one character to buffered stream
  421.  
  422.    SYNOPSIS
  423.     BPutChar(Char, Stream);
  424.          D0.B  A3
  425.  
  426.    FUNCTION
  427.     Put one character to buffered I/O stream opened for writing.
  428.  
  429.     This function performs EOL-checking and can be used on streams with
  430.     line buffering mode set.  If don't use this mode, you should better
  431.     use BPutChar which contains no additional checks and is slightly
  432.     faster.
  433.  
  434.    INPUTS
  435.     Char - character to be written
  436.  
  437.     Stream - I/O stream handle
  438.  
  439.    NOTE
  440.     This call modifies only A0.  A6 is not required to contain SSLib
  441.     base.  A5 can also contain illegal values, which makes this function
  442.     suitable for calling from non-SS environments.
  443.  
  444.    SEE ALSO
  445.     TrackOpenBuf, TrackBufHandle, BPutByte, BGetByte
  446.  
  447. ss.library/BPutLong                      ss.library/BPutLong
  448.  
  449.    NAME
  450.     BPutLong -- Put one longword to buffered stream
  451.  
  452.    SYNOPSIS
  453.     BPutLong(Long, Stream);
  454.          D0    A3
  455.  
  456.    FUNCTION
  457.     Put one longword to buffered I/O stream opened for writing.
  458.  
  459.     This function should be used for writing of streams which don't have
  460.     the line buffering mode set, because it contains no checks for line
  461.     end characters.
  462.  
  463.    INPUTS
  464.     Long - longword to be written
  465.  
  466.     Stream - I/O stream handle
  467.  
  468.    NOTE
  469.     This call modifies only A0 and D0.  A6 is not required to contain
  470.     SSLib base.
  471.  
  472.    SEE ALSO
  473.     TrackOpenBuf, TrackBufHandle, BPutWord, BPutLong, BGetLong
  474.  
  475. ss.library/BPuts                         ss.library/BPuts
  476.  
  477.    NAME
  478.     BPuts -- Put string
  479.  
  480.    SYNOPSIS
  481.     BPuts(String, Stream);
  482.           A0      A3
  483.  
  484.    FUNCTION
  485.     This function writes a string to buffered I/O stream opened for
  486.     writing.  The string is not terminated by any special byte.
  487.  
  488.     This function performs EOL-checking and can be used on streams with
  489.     line buffering mode set.
  490.  
  491.    INPUTS
  492.     String - string to be put
  493.  
  494.     Stream - I/O stream handle
  495.  
  496.    SEE ALSO
  497.     TrackOpenBuf,TrackBufHandle, BPutChar, BPutString, BPutsNL
  498.  
  499. ss.library/BPutsNL                       ss.library/BPutsNL
  500.  
  501.    NAME
  502.     BPutsNL -- Put EOL-terminated string
  503.  
  504.    SYNOPSIS
  505.     BPutsNL(String, Stream);
  506.         A0    A3
  507.  
  508.    FUNCTION
  509.     This function writes a string to buffered I/O stream opened for
  510.     writing.  The string is terminated by an EOL character.
  511.  
  512.     This function performs EOL-checking and can be used on streams with
  513.     line buffering mode set.
  514.  
  515.    INPUTS
  516.     String - string to be put
  517.  
  518.     Stream - I/O stream handle
  519.  
  520.    SEE ALSO
  521.     TrackOpenBuf,TrackBufHandle, BPutChar, BPutString, BPuts
  522.  
  523. ss.library/BPutString                    ss.library/BPutString
  524.  
  525.    NAME
  526.     BPutString -- Put null-terminated string
  527.  
  528.    SYNOPSIS
  529.     BPutString(String, Stream);
  530.            A0       A3
  531.  
  532.    FUNCTION
  533.     This function writes a string to buffered I/O stream opened for
  534.     writing.  The string is succeeded by terminating zero byte.
  535.  
  536.     This function should be used for writing of streams which don't have
  537.     the line buffering mode set, because it contains no checks for line
  538.     end characters.
  539.  
  540.    INPUTS
  541.     String - string to be put
  542.  
  543.     Stream - I/O stream handle
  544.  
  545.    SEE ALSO
  546.     TrackOpenBuf,TrackBufHandle, BPutByte, BPuts, BPutsNL
  547.  
  548. ss.library/BPutWord                      ss.library/BPutWord
  549.  
  550.    NAME
  551.     BPutWord -- Put one word to buffered stream
  552.  
  553.    SYNOPSIS
  554.     BPutWord(Word, Stream);
  555.          D0.W  A3
  556.  
  557.    FUNCTION
  558.     Put one word to buffered I/O stream opened for writing.
  559.  
  560.     This function should be used for writing of streams which don't have
  561.     the line buffering mode set, because it contains no checks for line
  562.     end characters.
  563.  
  564.    INPUTS
  565.     Word - word to be written
  566.  
  567.     Stream - I/O stream handle
  568.  
  569.    NOTE
  570.     This call modifies only A0.  A6 is not required to contain SSLib
  571.     base.
  572.  
  573.    SEE ALSO
  574.     TrackOpenBuf, TrackBufHandle, BPutByte, BPutLong, BGetWord
  575.  
  576. ss.library/BRead                         ss.library/BRead
  577.  
  578.    NAME
  579.     BRead -- Read block from buffered I/O stream
  580.  
  581.    SYNOPSIS
  582.     Size = BRead(Buffer, Size, Stream);
  583.     D0         A0      D0    A2
  584.  
  585.    FUNCTION
  586.     Reads a block of given size from buffered I/O stream.  If less then
  587.     Size bytes are available, only partial read is done and the real
  588.     number of bytes read is returned.
  589.  
  590.    INPUTS
  591.     Buffer - buffer to read the block to
  592.  
  593.     Size - block size
  594.  
  595.     Stream - stream to read from
  596.  
  597.    RESULT
  598.     Size - number of bytes read (0=EOF)
  599.  
  600.    SEE ALSO
  601.     TrackOpenBuf, TrackBufHandle, BGetByte, BWrite
  602.  
  603. ss.library/BRelSeek                      ss.library/BRelSeek
  604.  
  605.    NAME
  606.     BRelSeek -- Relative seek in buffered I/O stream
  607.  
  608.    SYNOPSIS
  609.     BRelSeek(Stream, Position);
  610.          A2     D0
  611.  
  612.    FUNCTION
  613.     Advance position in buffered I/O stream opened for reading by given
  614.     amount.  bh_seekfunc must be available to do this.
  615.  
  616.    INPUTS
  617.     Stream - stream to seek in
  618.  
  619.     Position - position to move by
  620.  
  621.    NOTE
  622.     The biob_eof flag bit is reset.
  623.  
  624.    SEE ALSO
  625.     BSeek, BTell, TrackOpenBuf, TrackBufHandle
  626.  
  627. ss.library/BSeek                         ss.library/BSeek
  628.  
  629.    NAME
  630.     BSeek -- Seek in buffered I/O stream
  631.  
  632.    SYNOPSIS
  633.     BSeek(Stream, Position);
  634.           A2      D0
  635.  
  636.    FUNCTION
  637.     Sets position in buffered I/O stream opened for reading to given
  638.     value .  bh_seekfunc must be available to do this.
  639.  
  640.    INPUTS
  641.     Stream - stream to seek in
  642.  
  643.     Position - position to move to
  644.  
  645.    NOTE
  646.     The biob_eof flag bit is reset.
  647.  
  648.    SEE ALSO
  649.     BRelSeek, BTell, TrackOpenBuf, TrackBufHandle
  650.  
  651. ss.library/BTell                         ss.library/BTell
  652.  
  653.    NAME
  654.     BTell -- Get current position in buffered I/O stream
  655.  
  656.    SYNOPSIS
  657.     Position = BTell(Stream);
  658.     D0         A2
  659.  
  660.    FUNCTION
  661.     Calculates current position in given buffered I/O stream.  Both read
  662.     and write streams may be used.
  663.  
  664.    INPUTS
  665.     Stream - stream to get position of
  666.  
  667.    RESULT
  668.     Position - current position in given stream
  669.  
  670.    NOTE
  671.     This function modifies only D0.
  672.  
  673.     Can be inlined easily as:
  674.  
  675.         move.l    bh_current(A2),D0
  676.         sub.l    bh_buffer(A2),D0
  677.         add.l    bh_position(A2),D0
  678.  
  679.    SEE ALSO
  680.     BSeek, BRelSeek, TrackOpenBuf, TrackBufHandle
  681.  
  682. ss.library/BUnGetc                       ss.library/BUnGetc
  683.  
  684.    NAME
  685.     BUnGetc -- Push back one character to I/O stream
  686.  
  687.    SYNOPSIS
  688.     BUnGetc(Char, Stream);
  689.         D0    A2
  690.  
  691.    FUNCTION
  692.     For read streams: Pushes given character back to the stream buffer.
  693.     It's possible to push back only one character without reading it.
  694.  
  695.     If applied to write streams, it discards the last character written.
  696.     Only the recently written character may be discarded.  The Char
  697.     parameter is ignored.  It is not possible to undo last character
  698.     written by BWrite.
  699.  
  700.     If you seek the read stream you have pushed the character back, you
  701.     can obtain this character in its original or changed form, depending
  702.     on local conditions.  To avoid this strange behavior, use BFlush
  703.     before seeking.
  704.  
  705.    INPUTS
  706.     Char - character to be pushed back
  707.  
  708.     Stream - stream to push the character to
  709.  
  710.    NOTE
  711.     This call modifies only A0.  A6 is not required to contain SSLib
  712.     base.
  713.  
  714.     Can be inlined easily as:
  715.  
  716.         move.l    bh_current(A2),A0
  717.         move.b    D0,-(A0)
  718.         move.l    A0,bh_current(A2)
  719.  
  720.    SEE ALSO
  721.     BGetByte, BPutByte, BGetChar
  722.  
  723. ss.library/BWrite                        ss.library/BWrite
  724.  
  725.    NAME
  726.     BWrite -- Write block to buffered I/O stream
  727.  
  728.    SYNOPSIS
  729.     BWrite(Buffer, Size, Stream);
  730.            A0      D0    A3
  731.  
  732.    FUNCTION
  733.     Writes a block of given size to buffered I/O stream.
  734.  
  735.     This function should be used for writing of streams which don't have
  736.     the line buffering mode set, because it contains no checks for line
  737.     end characters.
  738.  
  739.    INPUTS
  740.     Buffer - block to be written
  741.  
  742.     Size - block size
  743.  
  744.     Stream - stream to write to
  745.  
  746.    SEE ALSO
  747.     TrackOpenBuf, TrackBufHandle, BPutByte, BRead
  748.  
  749. ss.library/CallBlock                     ss.library/CallBlock
  750.  
  751.    NAME
  752.     CallBlock -- Call a subprogram.
  753.  
  754.    SYNOPSIS
  755.     Failure = CallBlock(Routine, LeaveResources);
  756.     D0            A0         D0
  757.  
  758.    FUNCTION
  759.     Calls a subprogram.
  760.  
  761.     If the subprogram fails or LeaveResources=0, all resources allocated
  762.     by it are freed.
  763.  
  764.     If it doesn't fail and LeaveResources<>0, these resources are added
  765.     to current resource list of the caller.
  766.  
  767.     Registers D1-D7/A0-A6 are passed to called subprogram without
  768.     changes.  If it returns normally, D1-D7/A0-A4/A6 are passed back to
  769.     the caller.  In case of failure (return via ExitError), D2-D7/A2-A6
  770.     contain their original values (before call), values of D1/A0-A1 are
  771.     unexpectable.
  772.  
  773.    INPUTS
  774.     Routine - address of subroutine to be called
  775.  
  776.     LeaveResources - boolean value indicating that you want the resources
  777.         allocated by the subprogram to be allocated.  If not set,
  778.         they are freed automatically before return.
  779.  
  780.    RESULT
  781.     Failure - non-zero value if the routine has failed.
  782.  
  783.    NOTE
  784.     The called subprogram is not allowed to create its own resource
  785.     lists.
  786.  
  787.    SEE ALSO
  788.     MergeResLists
  789.  
  790. ss.library/ChkDoIO                       ss.library/ChkDoIO
  791.  
  792.    NAME
  793.     ChkDoIO -- Perform an I/O operation and test error.
  794.  
  795.    SYNOPSIS
  796.     Error = ChkDoIO(Message, DeviceTracker);
  797.     D0        A0     A1
  798.  
  799.    FUNCTION
  800.     This function acts like DoIO in exec.library with the following
  801.     differences, which make it easier to use in programs doing simple
  802.     I/O:
  803.  
  804.     - IO_FLAGS are NOT set to $01 (DoIO does it, but ChkDoIO sets only
  805.       the IOB_QUICK bit).  It makes ChkDoIO capable of handling I/O
  806.       commands requiring special information in flags.
  807.  
  808.     - While waiting for finish of the operation, the user may hit CTRL-C
  809.       and try to abort it.
  810.  
  811.     - If err_iofail and err_iofail2 bits are set, ChkDoIO does automatic
  812.       processing of I/O errors.  In this case, it uses the error table
  813.       stored in the device tracker (see TrackDevice) and the custom error
  814.       string.  If the error string has been found, "<Message> -
  815.       <error string>" is displayed and err_iofail2 is used.  In other
  816.       cases, "<Message> - <xxx.device> error <errcode>" and err_iofail is
  817.       used.
  818.  
  819.    INPUTS
  820.     Message - optional error message (if NULL, "I/O error" will be used)
  821.  
  822.     DeviceTracker - tracker of device to perform the I/O operation with.
  823.         It must contain reference to the error table (may be NULL).
  824.  
  825.    RESULT
  826.     Error - error code or 0 if successful.
  827.  
  828.    WARNING
  829.     It is not possible to use ChkDoIO on device trackers which don't
  830.     contain the error table.  A NULL pointer is a valid error table.
  831.  
  832.    SEE ALSO
  833.     TrackDevice, exec/DoIO
  834.  
  835. ss.library/ChkRead                       ss.library/ChkRead
  836.  
  837.    NAME
  838.     ChkRead -- Read from file and test error or EOF.
  839.  
  840.    SYNOPSIS
  841.     Success = ChkRead(Tracker, Buffer, Size);
  842.     D0          A0       A1       D0
  843.  
  844.    FUNCTION
  845.     Read from file and report any errors.  The file tracker is used
  846.     instead of file handle, because it contains file name used for error
  847.     reporting.  The report is generated whenever the size of read data is
  848.     not equal to the size specified as a parameter, therefore ChkRead
  849.     cannot be used for reading from interactive files (consoles etc.).
  850.  
  851.    INPUTS
  852.     Tracker - tracker of file to read the data from.
  853.  
  854.     Buffer - buffer to read the data to.
  855.  
  856.     Size - size of block you want to read.
  857.  
  858.    RESULT
  859.     Success - boolean value indicating success.
  860.  
  861.    WARNING
  862.     File name specified by a call to TrackFile must be still on its place
  863.     and mustn't be changed in any way.
  864.  
  865.    SEE ALSO
  866.     ChkTryRead, ChkWrite, TrackOpen, LoadFile
  867.  
  868. ss.library/ChkTryRead                    ss.library/ChkTryRead
  869.  
  870.    NAME
  871.     ChkTryRead -- Read from file and test error.
  872.  
  873.    SYNOPSIS
  874.     Size = ChkTryRead(Tracker, Buffer, Size);
  875.     D0          A0       A1       D0
  876.  
  877.    FUNCTION
  878.     Read from file and report any errors.  The file tracker is used
  879.     instead of file handle, because it contains file name used for error
  880.     reporting.
  881.  
  882.    INPUTS
  883.     Tracker - tracker of file to read the data from.
  884.  
  885.     Buffer - buffer to read the data to.
  886.  
  887.     Size - maximal size of block you want to read.
  888.  
  889.    RESULT
  890.     Size - number of bytes read.  0 if EOF.
  891.  
  892.    WARNING
  893.     File name specified by a call to TrackFile must be still on its place
  894.     and mustn't be changed in any way.
  895.  
  896.    NOTE
  897.     If the err_read bit is not set, you cannot see whether the zero value
  898.     returned is caused by read error or EOF.  But if you don't have the
  899.     error bit set, ChkTryRead is functionally equivalent to dos/Read.
  900.  
  901.    SEE ALSO
  902.     ChkRead, ChkWrite, TrackOpen, LoadFile
  903.  
  904. ss.library/ChkWrite                      ss.library/ChkWrite
  905.  
  906.    NAME
  907.     ChkWrite -- Write to file and test error.
  908.  
  909.    SYNOPSIS
  910.     Success = ChkWrite(Tracker, Buffer, Size);
  911.     D0           A0        A1        D0
  912.  
  913.    FUNCTION
  914.     Write to file and report any errors.  The file tracker is used
  915.     instead of file handle, because it contains file name used for error
  916.     reporting.  The report is generated whenever the size of written data
  917.     is not equal to the size specified as a parameter.
  918.  
  919.    INPUTS
  920.     Tracker - tracker of file to write the data to.
  921.  
  922.     Buffer - address of data to be written.
  923.  
  924.     Size - size of block you want to write.
  925.  
  926.    RESULT
  927.     Success - boolean value indicating success.
  928.  
  929.    WARNING
  930.     File name specified by a call to TrackFile must be still on its place
  931.     and mustn't be changed in any way.
  932.  
  933.    SEE ALSO
  934.     ChkRead, TrackOpen
  935.  
  936. ss.library/CreateResList                 ss.library/CreateResList
  937.  
  938.    NAME
  939.     CreateResList -- Create new resource list.
  940.  
  941.    SYNOPSIS
  942.     ResList = CreateResList();
  943.     D0
  944.  
  945.    FUNCTION
  946.     Create local resource list.  It can be useful if you need to have
  947.     local resources allocated in some part of program and freed after
  948.     leaving it and you don't want to free them separately by
  949.     FreeObject().
  950.  
  951.    RESULT
  952.     ResList - Pointer to created ResourceList structure.
  953.  
  954.    SEE ALSO
  955.     FreeResList, FreeAllResLists
  956.  
  957. ss.library/DisplayError                   ss.library/DisplayError
  958.  
  959.    NAME
  960.     DisplayError -- Display error message without exiting.
  961.  
  962.    SYNOPSIS
  963.     DisplayError(Text, Params);
  964.              A0    A1
  965.  
  966.    FUNCTION
  967.     Display an error message using standard or user-supplied error
  968.     displaying mechanism (it defaults to writing of the message into
  969.     standard output if it exists or to displaying a requester with it if
  970.     started from WB with no console window).  Using of requesters
  971.     (equivalent to SimpleRequest(A0,A1,"Exit")) for the default error
  972.     routine can be forced by the ssf_errorreq flag or the sst_errorreq
  973.     tag.
  974.  
  975.     This function automatically adds an exclamation mark ('!') to the
  976.     message and is able to process printf-style arguments.
  977.  
  978.     It's better if the error message isn't longer than one line.
  979.  
  980.    INPUTS
  981.     Text - pointer to message you want to display (MUSTN'T EXCEED 200
  982.         BYTES!!!)
  983.  
  984.     Params - pointer to optional parameters used for printf-style
  985.         formatting
  986.  
  987.    SEE ALSO
  988.     ExitError, DosError, ReportError, SimpleRequest, exec/RawDoFmt
  989.  
  990. ss.library/DosError                      ss.library/DosError
  991.  
  992.    NAME
  993.     DosError -- Exit with DOS error.
  994.  
  995.    SYNOPSIS
  996.     DosError(Text, Params);
  997.          A0    A1
  998.  
  999.    FUNCTION
  1000.     Display an error message followed by DOS fault string explaining why
  1001.     did error happen.  The DOS error number is determined from the
  1002.     dos/IoErr() function, therefore you must call DosError() directly
  1003.     after the function, which caused the error without calling any other
  1004.     DOS functions (directly or indirectly).
  1005.  
  1006.     The program is terminated via standard exit mechanism with return
  1007.     code according to sv_errrc.
  1008.  
  1009.     If IoErr() returns zero (no error cause known), the supplied message
  1010.     is simply passed to ExitError().  If there is no such message,
  1011.     "Unknown DOS Error" is used.
  1012.  
  1013.    INPUTS
  1014.     Text - message text, can be empty (in this case, only the fault
  1015.         string is shown).
  1016.  
  1017.     Params - pointer to optional parameters used for printf-style
  1018.         formatting.
  1019.  
  1020.    NOTE
  1021.     A5 may contain incorrect value on entry.  SSLib is able to find the
  1022.     correct pointer automatically.
  1023.  
  1024.    SEE ALSO
  1025.     ExitCleanup, ExitError
  1026.  
  1027. ss.library/ExitCleanup                       ss.library/ExitCleanup
  1028.  
  1029.    NAME
  1030.     ExitCleanup -- Clean up and exit.
  1031.  
  1032.    SYNOPSIS
  1033.     ExitCleanup();
  1034.  
  1035.  
  1036.    FUNCTION
  1037.     This service exits the program after performing some cleanup actions:
  1038.  
  1039.     - A5 is tested for correct value.  If it contains garbage, the
  1040.       current task is searched for in the caller table.  If it isn't
  1041.       found, the alert AN_ExitCrash is displayed.  (this very fatal
  1042.       situation shouldn't occur).
  1043.  
  1044.     - the user's exit routine (sv_exitrout) is called.
  1045.  
  1046.     - all tracked resources are freed using FreeAllResLists().
  1047.  
  1048.     - all arguments supplied by DOS are freed.
  1049.  
  1050.     - the block of variables pointed to by A5 is freed.
  1051.  
  1052.     - some other actions which needn't to be described here.
  1053.  
  1054.    RESULT
  1055.     Completely clean environment (all objects can be recycled...)
  1056.  
  1057.    NOTE
  1058.     A5 may contain incorrect value on entry.  SSLib is able to find the
  1059.     correct pointer automatically.
  1060.  
  1061.    SEE ALSO
  1062.     StartupInit, ExitError, DosError
  1063.  
  1064. ss.library/ExitError                     ss.library/ExitError
  1065.  
  1066.    NAME
  1067.     ExitError -- Display error message and exit.
  1068.  
  1069.    SYNOPSIS
  1070.     ExitError(Text, Params);
  1071.           A0    A1
  1072.  
  1073.    FUNCTION
  1074.     Display an error message using DisplayError and exit the program with
  1075.     return code sv_errrc.
  1076.  
  1077.     It's better if the error message isn't longer than one line.
  1078.  
  1079.    INPUTS
  1080.     Text - pointer to error message (MUSTN'T EXCEED 200 BYTES!!!)
  1081.  
  1082.     Params - optional pointer for parameters used for printf-style
  1083.         formatting
  1084.  
  1085.    RESULT
  1086.     Horrified user.
  1087.  
  1088.    NOTE
  1089.     A5 may contain incorrect value on entry.  SSLib is able to find the
  1090.     correct pointer automatically.
  1091.  
  1092.    SEE ALSO
  1093.     DisplayError, ExitCleanup
  1094.  
  1095. ss.library/FindHashItem                   ss.library/FindHashItem
  1096.  
  1097.    NAME
  1098.     FindHashItem -- Find item in hashed tree.
  1099.  
  1100.    SYNOPSIS
  1101.     UserDate = FindHashItem(Tree, ItemName);
  1102.     D0            A0    A1
  1103.  
  1104.    FUNCTION
  1105.     Find an item in hashed tree.  It's able to find only one occurence of
  1106.     given string.
  1107.  
  1108.    INPUTS
  1109.     Tree - hashed tree represented by its tracker
  1110.  
  1111.     ItemName - text key to find
  1112.  
  1113.    RESULT
  1114.     UserDate - Pointer to user data area of the item.  (Additional fields
  1115.         reachable from this point are listed in AddHashItem doc).
  1116.         NULL if not found.
  1117.  
  1118.    SEE ALSO
  1119.     InitHashTree, AddHashItem, FreeObject
  1120.  
  1121. ss.library/FormatStr                     ss.library/FormatStr
  1122.  
  1123.    NAME
  1124.     FormatStr -- Format data according to template.
  1125.  
  1126.    SYNOPSIS
  1127.     FormatStr(Format, Data, DestBuf);
  1128.           A0      A1    A2
  1129.  
  1130.    FUNCTION
  1131.     This function performs something like sprintf() in C.  It calls
  1132.     exec/RawDoFmt with simple PutC routine, which stores all characters
  1133.     into supplied destination buffer.
  1134.  
  1135.    INPUTS
  1136.     Format - pointer to format string
  1137.  
  1138.     Data - pointer to parameters
  1139.  
  1140.     DestBuf - pointer to destination buffer
  1141.  
  1142. ss.library/FreeAllResLists               ss.library/FreeAllResLists
  1143.  
  1144.    NAME
  1145.     FreeAllResLists -- Free all resource lists.
  1146.  
  1147.    SYNOPSIS
  1148.     FreeAllResLists();
  1149.  
  1150.  
  1151.    FUNCTION
  1152.     Free all tracked resources in all resource lists and discard all the
  1153.     lists.    Used by ExitCleanup().
  1154.  
  1155.    SEE ALSO
  1156.     FreeResList, ExitCleanup
  1157.  
  1158. ss.library/FreeObject                    ss.library/FreeObject
  1159.  
  1160.    NAME
  1161.     FreeObject -- Free tracked object.
  1162.  
  1163.    SYNOPSIS
  1164.     FreeObject(Tracker);
  1165.            A0
  1166.  
  1167.    FUNCTION
  1168.     Free tracked object and remove the tracker.  For master trackers,
  1169.     free all slave trackers.
  1170.  
  1171.     All trackers, which are not freed by calling of this service, will be
  1172.     freed during the ExitCleanup process.  It will be done in reverse
  1173.     order of their tracking.  Trackers connected as slaves will be
  1174.     handled as usually (see below).
  1175.  
  1176.     The freeing routines may fail.    In this case, the resource freeing
  1177.     process will be started again and the tracker will be freed without
  1178.     calling the routine which caused the failure.
  1179.  
  1180.     The freeing routine for given tracker type is called only if the
  1181.     trk_data field is not 0.  But the tracker itself is freed in any
  1182.     case.
  1183.  
  1184.     If you free a tracker, which is a slave of some other tracker, the
  1185.     tracked resource is correctly freed, but the tracker node remains in
  1186.     memory until the master tracker is freed.
  1187.  
  1188.    INPUTS
  1189.     Tracker - pointer to tracked object to be freed.
  1190.  
  1191.    SEE ALSO
  1192.     FreeResList, Track#?, FreeAllResLists, ExitCleanup
  1193.  
  1194. ss.library/FreeResList                       ss.library/FreeResList
  1195.  
  1196.    NAME
  1197.     FreeResList -- Free resource list.
  1198.  
  1199.    SYNOPSIS
  1200.     FreeResList();
  1201.  
  1202.  
  1203.    FUNCTION
  1204.     Free all tracked objects in the top-level resource list and remove
  1205.     the list.  Used to free local resource lists.  The object are removed
  1206.     in head-to-tail order, therefore the object list acts as a LIFO
  1207.     buffer.
  1208.  
  1209.    SEE ALSO
  1210.     CreateResList, FreeAllResLists, FreeObject, Track#?, ExitCleanup
  1211.  
  1212. ss.library/GetExtension                   ss.library/GetExtension
  1213.  
  1214.    NAME
  1215.     GetExtension -- Get filename extension.
  1216.  
  1217.    SYNOPSIS
  1218.     Extension = GetExtension(Name);
  1219.     D0             A0
  1220.  
  1221.    FUNCTION
  1222.     Get last extension of given filename.
  1223.  
  1224.    INPUTS
  1225.     Name - file name you want to get extension of
  1226.  
  1227.    RESULT
  1228.     Extension - Pointer to extension of the file name.  If there's no
  1229.         extension, the pointer points to the trailing NULL character
  1230.         of the name.
  1231.  
  1232.    NOTE
  1233.     A0=D0 on exit.
  1234.  
  1235.    SEE ALSO
  1236.     AddExtension, GetExtension, RemExtension
  1237.  
  1238. ss.library/GetResList                    ss.library/GetResList
  1239.  
  1240.    NAME
  1241.     GetResList -- Get pointer to current resource list.
  1242.  
  1243.    SYNOPSIS
  1244.     RList = GetResList();
  1245.     D0
  1246.  
  1247.    FUNCTION
  1248.     Get current top-level resource list.  If there is no resource list,
  1249.     new one is created.
  1250.  
  1251.    RESULT
  1252.     RList - pointer to the resl_list item of the top-level resource list.
  1253.  
  1254.    NOTE
  1255.     A0=D0 on exit.
  1256.  
  1257.    SEE ALSO
  1258.     CreateResList, FreeResList, Track#?
  1259.  
  1260. ss.library/InitHashTree                   ss.library/InitHashTree
  1261.  
  1262.    NAME
  1263.     InitHashTree -- Initialize a hashed tree.
  1264.  
  1265.    SYNOPSIS
  1266.     Tracker = InitHashTree(TableSize, Flags);
  1267.     D0               D0      D1
  1268.  
  1269.    FUNCTION
  1270.     Initialize a hashed tree.  The hashed tree is a simple structure
  1271.     containing data items accessed using text key.    SS Library allows to
  1272.     simply manage these trees with both case-dependent and
  1273.     case-independent key searching.
  1274.  
  1275.    INPUTS
  1276.     TableSize - number of entries in the hash table.  Each entry occupies
  1277.         4 bytes.  Must be a power of 2 between 8 and 32768.
  1278.  
  1279.     Flags - htf_nocase if all the comparisons have to be performed in
  1280.         case-insensitive manner.  It is significantly slower than the
  1281.         default case-sensitive algorithm.
  1282.  
  1283.    RESULT
  1284.     Tracker - hashed tree tracker.    The tree is referenced always by this
  1285.         tracker.
  1286.  
  1287.    SEE ALSO
  1288.     AddHashItem, FindHashItem, FreeObject
  1289.  
  1290. ss.library/IPAlloc                       ss.library/IPAlloc
  1291.  
  1292.    NAME
  1293.     IPAlloc -- Allocate memory in internal pool
  1294.  
  1295.    SYNOPSIS
  1296.     Block = IPAlloc(Size);
  1297.     D0        D0
  1298.  
  1299.    FUNCTION
  1300.     Allocates memory in task's private pool.  This private pool is
  1301.     created automatically during StartupInit and freed during
  1302.     ExitCleanup.  This pool is automatically used for storage of trackers
  1303.     and similar small objects.
  1304.  
  1305.     The primary use of this function is allocation of few small blocks of
  1306.     memory when creation of custom memory pool causes unwanted extra
  1307.     overhead.
  1308.  
  1309.    INPUTS
  1310.     Size - requested size
  1311.  
  1312.    RESULT
  1313.     Block - Pointer to allocated memory block.
  1314.  
  1315.    NOTE
  1316.     The block allocated by this function is guaranteed to be cleared.
  1317.  
  1318.     If there's not enough memory, the program is exited immediately.
  1319.  
  1320.    SEE ALSO
  1321.     PoolAlloc, StartupInit, ExitCleanup
  1322.  
  1323. ss.library/IPFree                        ss.library/IPFree
  1324.  
  1325.    NAME
  1326.     IPFree -- Free memory in internal pool.
  1327.  
  1328.    SYNOPSIS
  1329.     IPFree(Chunk, Size);
  1330.            A1     D0
  1331.  
  1332.    FUNCTION
  1333.     Frees memory allocated by IPAlloc.
  1334.  
  1335.     Partial freeing is not allowed.
  1336.  
  1337.    INPUTS
  1338.     Chunk - address of memory chunk you want to free.
  1339.  
  1340.     Size - size of the chunk.
  1341.  
  1342.    SEE ALSO
  1343.     TrackPool, PoolAlloc
  1344.  
  1345. ss.library/LinearAlloc                       ss.library/LinearAlloc
  1346.  
  1347.    NAME
  1348.     LinearAlloc -- Allocate word-aligned space in linear pool.
  1349.  
  1350.    SYNOPSIS
  1351.     Mem = LinearAlloc(Pool, Size);
  1352.     D0          A0    D1
  1353.  
  1354.    FUNCTION
  1355.     Allocates memory in given linear memory pool (created by
  1356.     TrackLinPool).
  1357.  
  1358.     If Size is less or equal to free space in current memory chunk, the
  1359.     memory is taken from it.  In all other cases, new memory chunk is
  1360.     created.  If Size>Quantum, the new chunk is expanded to satisfy the
  1361.     request.
  1362.  
  1363.    INPUTS
  1364.     Pool - tracker of linear memory pool to allocate the block in
  1365.  
  1366.     Size - requested size
  1367.  
  1368.    RESULT
  1369.     Mem - Pointer to allocated memory block (always even) or NULL if no
  1370.         memory available and err_memory disabled.
  1371.  
  1372.    NOTE
  1373.     If you don't depend on evenness of the allocated block, use
  1374.     LinearAllocN instead.
  1375.  
  1376.    FUNCTION
  1377.     Allocation of 0 bytes is allowed.
  1378.  
  1379.    INPUTS
  1380.     Pool - tracker of linear memory pool to allocate the block in
  1381.  
  1382.     Size - requested size
  1383.  
  1384.    RESULT
  1385.     Mem - Pointer to allocated memory block (always even) or NULL if no
  1386.         memory available and err_memory disabled.
  1387.  
  1388.    WARNING
  1389.     The Size parameter is given in D1 and NOT in D0 as usually the first
  1390.     non-address parameter is.
  1391.  
  1392.    SEE ALSO
  1393.     TrackLinPool, LinearAllocN
  1394.  
  1395. ss.library/LinearAllocN                   ss.library/LinearAllocN
  1396.  
  1397.    NAME
  1398.     LinearAllocN -- Allocate unaligned space in linear pool.
  1399.  
  1400.    SYNOPSIS
  1401.     Mem = LinearAllocN(Pool, Size);
  1402.     D0           A0     D1
  1403.  
  1404.    FUNCTION
  1405.     Allocates memory in given linear memory pool (created by
  1406.     TrackLinPool).    Doesn't word-align the allocation, therefore is
  1407.     usually used for allocation of strings.  Slightly faster than
  1408.     LinearAlloc.
  1409.  
  1410.     If Size is less or equal to free space in current memory chunk, the
  1411.     memory is taken from it.  In all other cases, new memory chunk is
  1412.     created.  If Size>Quantum, the new chunk is expanded to satisfy the
  1413.     request.
  1414.  
  1415.     Allocation of 0 bytes is allowed.
  1416.  
  1417.    INPUTS
  1418.     Pool - tracker of linear memory pool to allocate the block in
  1419.  
  1420.     Size - requested size
  1421.  
  1422.    RESULT
  1423.     Mem - Pointer to allocated memory block (may be odd) or NULL if no
  1424.         memory available and err_memory disabled.
  1425.  
  1426.    WARNING
  1427.     The Size parameter is given in D1 and NOT in D0 as usually the first
  1428.     non-address parameter is.
  1429.  
  1430.    SEE ALSO
  1431.     TrackLinPool, LinearAlloc
  1432.  
  1433. ss.library/LoadFile                      ss.library/LoadFile
  1434.  
  1435.    NAME
  1436.     LoadFile -- Load whole file to memory.
  1437.  
  1438.    SYNOPSIS
  1439.     File, Tracker = LoadFile(FileName);
  1440.     D0    D1         A0
  1441.  
  1442.    FUNCTION
  1443.     Read file from disk to memory.    Uses TrackOpen, TrackMem and ChkRead
  1444.     and reports their errors if enabled.
  1445.  
  1446.     This function is able to decrunch powerpacked files using the
  1447.     powerpacker library.  Encrypted files are not supported yet.
  1448.  
  1449.     Also files packed by the XPK library are automatically decrunched if
  1450.     the library is available.
  1451.  
  1452.     Error processing mechanism depends on err_openread and err_read error
  1453.     bits.
  1454.  
  1455.    INPUTS
  1456.     FileName - pointer to name of file you want to read.
  1457.  
  1458.    RESULT
  1459.     File - Pointer to file in memory.  The file is preceeded by one
  1460.         longword containing file size in bytes and is always
  1461.         null-terminated (useful mostly for text files).  Zero when
  1462.         unsuccessful and the default error processing is disabled.
  1463.  
  1464.     Tracker (D1) - Tracker of memory area containing the file or NULL if
  1465.         unsuccessful.
  1466.  
  1467.    NOTE
  1468.     The memory block the file is stored to is allocated via
  1469.     TrackAllocPub, therefore it's possible to specify your own memory
  1470.     requirements in sv_memattr (default MEMF_PUBLIC).
  1471.  
  1472.    BUGS
  1473.     Reading from interactive filehandles is not implemented, because it
  1474.     is not possible to estimate size of interactive file.  If requested,
  1475.     appropriate error message is displayed.
  1476.  
  1477.    SEE ALSO
  1478.     ChkRead, TrackOpen, TrackAlloc, FreeObject
  1479.  
  1480. ss.library/MergeResLists                 ss.library/MergeResLists
  1481.  
  1482.    NAME
  1483.     MergeResLists -- Merge two resource lists to one.
  1484.  
  1485.    SYNOPSIS
  1486.     MergeResLists();
  1487.  
  1488.  
  1489.    FUNCTION
  1490.     Merges current resource list with the previous one.  Returns without
  1491.     doing any action if less than two resource lists are defined.
  1492.  
  1493.     Used when you want to track some objects and connect them to the main
  1494.     resource list, but if some allocation fails, all the allocated
  1495.     objects have to be freed without freeing of the main resource list:
  1496.  
  1497.         CreateResList();
  1498.         -- do the allocations here --
  1499.         if (Failed) FreeResList();
  1500.         else MergeResLists();
  1501.  
  1502.     In many cases, it's better to use CallBlock which does many things
  1503.     automatically.
  1504.  
  1505.    SEE ALSO
  1506.     CreateResList, FreeResList, CallBlock
  1507.  
  1508. ss.library/ParseArgs                     ss.library/ParseArgs
  1509.  
  1510.    NAME
  1511.     ParseArgs -- Parse CLI Argument String.
  1512.  
  1513.    SYNOPSIS
  1514.     Success, Tracker = ParseArgs(Source, Template, ExtraHelp,
  1515.     D0     D1             A0      A1        A2
  1516.         Destination, Flags);
  1517.         A3         D0
  1518.  
  1519.    FUNCTION
  1520.     Parse arguments.  This function does something similar to
  1521.     dos/ReadArgs, but there are some little enhancements:
  1522.  
  1523.     - Automatic processing of errors (the program is automatically halted
  1524.       after error if it isn't disabled by the corresponding flag bit).
  1525.  
  1526.     - Ability to process non-decimal numbers in /N arguments (see
  1527.       StrToL).
  1528.  
  1529.     - Tracking functions are used for allocation of additional memory.
  1530.  
  1531.     - Provides mechanism for processing of default settings of non-/A
  1532.       arguments.
  1533.  
  1534.     - Arguments specified in default settings may be overriden or
  1535.       disabled by placing the minus ("-") sign before their keywords.
  1536.       For example:
  1537.  
  1538.         Let's have the template "NAME/K,SWITCH/S,ANOTHER/S"
  1539.         Default is "NAME Something ANOTHER"
  1540.         Parameters are "NAME Suspicious -ANOTHER SWITCH"
  1541.         Result is: NAME="Suspicious", ANOTHER=FALSE, SWITCH=TRUE
  1542.  
  1543.     The typical example of using ParseArgs with defaults is:
  1544.  
  1545.         if (! ParseArgs(Defaults,Template,&Vars,pafm_nofail |
  1546.            pafm_ignorea)) Report_Bad_Defaults;
  1547.         ParseArgs(Arguments,Template,&Vars,pafm_noclear);
  1548.  
  1549.     !! The /A arguments aren't taken from the defaults.
  1550.  
  1551.    INPUTS
  1552.     Source - string to be parsed.  NULL means that the string has too be
  1553.         fetched from the standard buffered input (this is where the
  1554.         default arguments are stored by the shell).
  1555.  
  1556.     Template - template describing the arguments.
  1557.  
  1558.     ExtraHelp - an extra help string to be displayed when the user enters
  1559.         '?' the second time.
  1560.  
  1561.     Destination - the array you want to store the arguments to.
  1562.  
  1563.     Flags - some flags controlling the parsing (see below).
  1564.  
  1565.    RESULT
  1566.     Success - boolean value indicating success (always true when the
  1567.         automatic error processing is turned on).
  1568.  
  1569.     Tracker (D1) - object tracker of buffers associated with the result
  1570.         of the parsing.
  1571.  
  1572.    FLAGS
  1573.     pafb_nofail - disable automatic processing of errors
  1574.  
  1575.     pafb_noclear - don't clear the array before parsing
  1576.  
  1577.     pafb_ignorea - don't check presence of /A arguments
  1578.  
  1579.    NOTE
  1580.     You can freely modify the arguments returned by this function.
  1581.  
  1582.    SEE ALSO
  1583.     StartupInit, StrToL, dos/ReadArgs
  1584.  
  1585. ss.library/PoolAlloc                     ss.library/PoolAlloc
  1586.  
  1587.    NAME
  1588.     PoolAlloc -- Allocate memory in private pool.
  1589.  
  1590.    SYNOPSIS
  1591.     Block = PoolAlloc(Pool, Size);
  1592.     D0          A0    D0
  1593.  
  1594.    FUNCTION
  1595.     Allocates memory in given memory pool (created by TrackPool).
  1596.  
  1597.     If Size is less or equal to Threshold of memory pool, the block is
  1598.     allocated inside some chunk.  If there is no free chunk, new one is
  1599.     created.  Large memory blocks are allocated separately and linked to
  1600.     the pool.
  1601.  
  1602.     Attempt to allocate 0 bytes of memory results in alert AN_AllocZero
  1603.     and termination of your program.
  1604.  
  1605.    INPUTS
  1606.     Pool - tracker of memory pool you want to allocate the block in
  1607.  
  1608.     Size - requested size
  1609.  
  1610.    RESULT
  1611.     Block - Pointer to allocated memory block.
  1612.  
  1613.    SEE ALSO
  1614.     TrackPool, PoolFree
  1615.  
  1616. ss.library/PoolFree                      ss.library/PoolFree
  1617.  
  1618.    NAME
  1619.     PoolFree -- Free memory in private pool.
  1620.  
  1621.    SYNOPSIS
  1622.     PoolFree(Pool, Chunk, Size);
  1623.          A0    A1     D0
  1624.  
  1625.    FUNCTION
  1626.     Frees memory allocated by PoolAlloc.
  1627.  
  1628.     Partial freeing is not allowed.
  1629.  
  1630.    INPUTS
  1631.     Pool - address of memory pool the chunk lies in.
  1632.  
  1633.     Chunk - address of memory chunk you want to free.
  1634.  
  1635.     Size - size of the chunk.
  1636.  
  1637.    SEE ALSO
  1638.     TrackPool, PoolAlloc
  1639.  
  1640. ss.library/Printf                        ss.library/Printf
  1641.  
  1642.    NAME
  1643.     Printf -- Glue to dos/VPrintf.
  1644.  
  1645.    SYNOPSIS
  1646.     Printf(Text, Params);
  1647.            A0    A1
  1648.  
  1649.    FUNCTION
  1650.     The VPrintf service in the dos library has its parameters in data
  1651.     registers, which usually involves many instructions for reordering of
  1652.     the arguments.    This service does this required shuffling and calls
  1653.     VPrintf.
  1654.  
  1655.    INPUTS
  1656.     Text - pointer to format string
  1657.  
  1658.     Params - pointer to parameter array
  1659.  
  1660.    SEE ALSO
  1661.     Puts, PutsNL, FormatString, dos/VPrintf
  1662.  
  1663. ss.library/Puts                           ss.library/Puts
  1664.  
  1665.    NAME
  1666.     Puts -- Glue to dos/FPuts.
  1667.  
  1668.    SYNOPSIS
  1669.     Puts(Text);
  1670.          A0
  1671.  
  1672.    FUNCTION
  1673.     There exists no puts() in the dos library and FPuts() has its
  1674.     parameters in data registers, which usually involves many
  1675.     instructions for reordering of the arguments.  This service does this
  1676.     required shuffling and calls FPuts with a filehandle of your stdout.
  1677.  
  1678.    INPUTS
  1679.     Text - pointer to message to print out
  1680.  
  1681.    SEE ALSO
  1682.     PutsNL, Printf, dos/FPuts
  1683.  
  1684. ss.library/PutsNL                        ss.library/PutsNL
  1685.  
  1686.    NAME
  1687.     PutsNL -- Glue to dos/FPuts.
  1688.  
  1689.    SYNOPSIS
  1690.     PutsNL(Text);
  1691.            A0
  1692.  
  1693.    FUNCTION
  1694.     There exists no puts() in the dos library and FPuts() does not emit a
  1695.     newline character after the string.  This function does the same
  1696.     action as Puts and puts an additional newline after the string.
  1697.  
  1698.    INPUTS
  1699.     Text - pointer to message to print out
  1700.  
  1701.    SEE ALSO
  1702.     Puts, Printf, dos/FPuts
  1703.  
  1704. ss.library/QuickSort                     ss.library/QuickSort
  1705.  
  1706.    NAME
  1707.     QuickSort -- Quickly sort an array.
  1708.  
  1709.    SYNOPSIS
  1710.     QuickSort(Base, NumEl, ElSize, CompFunc);
  1711.           A0    D0     D1      A1
  1712.  
  1713.    FUNCTION
  1714.     Sort array of records in ascending order.  Uses a variant of the
  1715.     QuickSort algorithm with minimal stack requirements.  Stack overflow
  1716.     handled and reported (err_stack).
  1717.  
  1718.     See qsort() in any C book.
  1719.  
  1720.     Uses various optimizations depending on record size.
  1721.  
  1722.    INPUTS
  1723.     Base - address of first element of the array
  1724.  
  1725.     NumEl - number of elements (may be zero)
  1726.  
  1727.     ElSize - size of one element (max.  65535)
  1728.  
  1729.     CompFunc - pointer to function used for comparison of two elements.
  1730.         Called with A0=&El1, A1=&El2.  Returns -1 if El1 < El2, 1 if
  1731.         El1 > El2, 0 if El1 == El2.  May modify D1, A0 and A1.    A5
  1732.         passed without changes.
  1733.  
  1734.    SEE ALSO
  1735.     SortLongs, SortStrings, SortList, SortListName
  1736.  
  1737. ss.library/RelinkObject                   ss.library/RelinkObject
  1738.  
  1739.    NAME
  1740.     RelinkObject -- Relink object to main resource list.
  1741.  
  1742.    SYNOPSIS
  1743.     RelinkObject(Object);
  1744.              A0
  1745.  
  1746.    FUNCTION
  1747.     Relink tracked object to the first resource list.
  1748.  
  1749.     You are not allowed to relink master/slave object.  This will be
  1750.     fixed in some future version.
  1751.  
  1752.    INPUTS
  1753.     Object - object to be relinked
  1754.  
  1755.    SEE ALSO
  1756.     TrackObject, CreateResList, FreeResList, FreeObject
  1757.  
  1758. ss.library/RemExtension                   ss.library/RemExtension
  1759.  
  1760.    NAME
  1761.     RemExtension -- Remove last extension from file name.
  1762.  
  1763.    SYNOPSIS
  1764.     RemExtension(Name);
  1765.              A0
  1766.  
  1767.    FUNCTION
  1768.     Remove filename extension if there's any.
  1769.  
  1770.    INPUTS
  1771.     Name - pointer to file name to remove extension of
  1772.  
  1773.    SEE ALSO
  1774.     AddExtension, SetExtension, GetExtension
  1775.  
  1776. ss.library/ReportError                       ss.library/ReportError
  1777.  
  1778.    NAME
  1779.     ReportError -- Handle an error condition.
  1780.  
  1781.    SYNOPSIS
  1782.     ReportError(ErrorCode, Arg1, Arg2, Arg3);
  1783.             D0           A1    D2    D3
  1784.  
  1785.    FUNCTION
  1786.     If the error bit corresponding to given error code is clear, error
  1787.     message is displayed and the program is stopped via ExitError().
  1788.  
  1789.     If the error bit is set, nothing happens and ReportError() returns
  1790.     with zero in both D0 and D1.
  1791.  
  1792.    INPUTS
  1793.     ErrorCode - code of error which has happened (see ss.i)
  1794.  
  1795.     Arg1 - first argument to be substituted to error message
  1796.  
  1797.     Arg2 - second argument
  1798.  
  1799.     Arg3 - third argument
  1800.  
  1801.    SEE ALSO
  1802.     ExitError, DisplayError, DosError
  1803.  
  1804. ss.library/SetExtension                   ss.library/SetExtension
  1805.  
  1806.    NAME
  1807.     SetExtension -- Set last extension in file name.
  1808.  
  1809.    SYNOPSIS
  1810.     Success = SetExtension(Name, Buffer, Extension, BufSize);
  1811.     D0               A0    A1      A2     D0
  1812.  
  1813.    FUNCTION
  1814.     Set last extension of given file name or add it if there's no
  1815.     extension yet.
  1816.  
  1817.    INPUTS
  1818.     Name - name to set extension in
  1819.  
  1820.     Buffer - buffer to store the result to
  1821.  
  1822.     Extension - extension to be used
  1823.  
  1824.     BufSize - size of the buffer
  1825.  
  1826.    RESULT
  1827.     Success - TRUE if successful, FALSE if buffer overflow.
  1828.  
  1829.    SEE ALSO
  1830.     AddExtension, GetExtension, RemExtension
  1831.  
  1832. ss.library/SimpleRequest                 ss.library/SimpleRequest
  1833.  
  1834.    NAME
  1835.     SimpleRequest -- Simple stub for EasyRequest.
  1836.  
  1837.    SYNOPSIS
  1838.     num = SimpleRequest(Text, Params, Gadgets);
  1839.     D0            A0      A1      A2
  1840.  
  1841.    FUNCTION
  1842.     Display a message using intuition/EasyRequest, but with significantly
  1843.     simpler arguments.  For additional information see EasyRequest.
  1844.  
  1845.    INPUTS
  1846.     Text - pointer to message you want to display
  1847.  
  1848.     Params - pointer to optional parameters for printf-style formatting
  1849.  
  1850.     Gadgets - pointer to string containing texts for requester gadgets
  1851.         separated by '|'
  1852.  
  1853.    RESULT
  1854.     num - See EasyRequest
  1855.  
  1856.    SEE ALSO
  1857.     DisplayError, intuition/EasyRequest
  1858.  
  1859. ss.library/SortList                      ss.library/SortList
  1860.  
  1861.    NAME
  1862.     SortList -- Sort linked list.
  1863.  
  1864.    SYNOPSIS
  1865.     SortList(List, Func);
  1866.          A0    A1
  1867.  
  1868.    FUNCTION
  1869.     Sort standard double-linked list using user-supplied node comparison
  1870.     function.
  1871.  
  1872.    INPUTS
  1873.     List - pointer to list header
  1874.  
  1875.     Func - pointer to function used for comparision of two list nodes.
  1876.         A0=&&Node1, A1=&&Node2.  Returns -1 if Node1 < Node2, 1 if
  1877.         Node1 > Node2 and 0 if Node1 == Node2.    A5 is passed without
  1878.         changes.
  1879.  
  1880.    WARNING
  1881.     This function allocates a block of memory and _requires_ the
  1882.     err_memory bit set.
  1883.  
  1884.    SEE ALSO
  1885.     QuickSort, SortListName
  1886.  
  1887. ss.library/SortListName                   ss.library/SortListName
  1888.  
  1889.    NAME
  1890.     SortListName -- Sort linked list by node name.
  1891.  
  1892.    SYNOPSIS
  1893.     SortListName(List);
  1894.              A0
  1895.  
  1896.    FUNCTION
  1897.     Sort standard double-linked list by LN_NAME.  (uses utility/Stricmp
  1898.     for comparison of node names)
  1899.  
  1900.    INPUTS
  1901.     List - pointer to list header
  1902.  
  1903.    WARNING
  1904.     This function allocates a block of memory and _requires_ the
  1905.     err_memory bit set.
  1906.  
  1907. ss.library/SortLongs                     ss.library/SortLongs
  1908.  
  1909.    NAME
  1910.     SortLongs -- Sort an array of unsigned longwords.
  1911.  
  1912.    SYNOPSIS
  1913.     SortLongs(Array, NumEl);
  1914.           A0     D0
  1915.  
  1916.    FUNCTION
  1917.     Sort an array of unsigned longword integers in ascending order.
  1918.  
  1919.    INPUTS
  1920.     Array - pointer to array you want to sort
  1921.  
  1922.     NumEl - number of elements
  1923.  
  1924.    SEE ALSO
  1925.     QuickSort, SortStrings
  1926.  
  1927. ss.library/SortStrings                       ss.library/SortStrings
  1928.  
  1929.    NAME
  1930.     SortStrings -- Sort an array of string pointers.
  1931.  
  1932.    SYNOPSIS
  1933.     SortStrings(Array, NumEl);
  1934.             A0       D0
  1935.  
  1936.    FUNCTION
  1937.     Sort an array of string pointers in ascending order of strings.  Uses
  1938.     utility/Stricmp to compare the strings.
  1939.  
  1940.    INPUTS
  1941.     Array - pointer to array you want to sort
  1942.  
  1943.     NumEl - number of elements
  1944.  
  1945.    SEE ALSO
  1946.     QuickSort, SortLongs
  1947.  
  1948. ss.library/StartupInit                       ss.library/StartupInit
  1949.  
  1950.    NAME
  1951.     StartupInit -- Standard startup procedure of program.
  1952.  
  1953.    SYNOPSIS
  1954.     StartupInit(StartupStruct, WbMsg);
  1955.             A0           D7
  1956.  
  1957.    FUNCTION
  1958.     Performs standard startup initialization which includes:
  1959.  
  1960.     - Checks ss.library version requested by your program.
  1961.  
  1962.     - Allocate space for system variables and your own variables.  The A5
  1963.       register points to this memory region (directly to the ssbase item)
  1964.       allowing simple determination of the library base using
  1965.           MOVE.L (A5),A6.
  1966.       The system variables are stored below A5 (as described in SS.i) and
  1967.       may grow in future releases.    Your own variables are stored above
  1968.       A5.  The amount of user's variables is stored in the StartupStruct
  1969.       (as described below).
  1970.  
  1971.     - All system variables are initialized to their proper values.
  1972.  
  1973.     - All of your own variables are initialized to zeroes.
  1974.  
  1975.     - Automatically opens some libraries (dos, intuition, gfx, gadtools,
  1976.       utility)
  1977.  
  1978.     - Program name is determined and stored to system variable.
  1979.  
  1980.     - Current task is added to the CallerList, which allows to recover
  1981.       from a soft crash (see ExitCleanup for further explaination).
  1982.  
  1983.     - All actions requested by the tags are done (see below).
  1984.  
  1985.     - The arguments are parsed in both CLI and WB modes.  If the WB has
  1986.       called us, the tool types are parsed using supplied template and
  1987.       converted to CLI arguments.  If there's a multi-selected icon, it
  1988.       will be used as the first argument (if the first argument is /M,
  1989.       all multiselected icons will be parsed).  If the program has been
  1990.       called as a default tool of some project, the project's name is
  1991.       used as the 1st argument.  If there is some icon used as the first
  1992.       argument, its tool types override the program's ones.
  1993.  
  1994.     - If the program is started from Workbench, its current directory is
  1995.       set to its home directory or to directory containing the first
  1996.       argument.
  1997.  
  1998.     - Task's exception handler is replaced by custom one.  It shows all
  1999.       address and data registers, the program counter and the status
  2000.       register (SR).  The user may suspend the program, try to abort it
  2001.       (in this case, all resources tracked by SS functions are freed) or
  2002.       reboot the machine.  [The exception code is NOT replaced if there
  2003.       is already another exception handler stored in RAM -> you can use
  2004.       breakpoints in your favourite debugger etc.] [The algorithm used
  2005.       for detection of custom exception handler might have some problems
  2006.       with future kickstarts larger than 1/2 Meg.]
  2007.  
  2008.     - Address of the ExitCleanup function is pushed onto stack allowing
  2009.       simple exit by usual RTS instruction.
  2010.  
  2011.     The tags parsed by this function are stored in a special (read:
  2012.     non-standard) format.  This format uses variable-length tagitems:
  2013.  
  2014.     a) Special SSLib trackers (codes 0000-3FFF).  These trackers have
  2015.     absolutely non-systematic arguments, therefore if SSLib encounters
  2016.     any unknown tag of this type (e.g., generated by newer version of the
  2017.     macros), it can't be simply ignored => the "Unknown Tracker" alert is
  2018.     shown and the program is terminated.  If you use these trackers, make
  2019.     sure that your "required version number" value matches all these tag
  2020.     types you're using.  This is usually done automatically by ssmac.h.
  2021.  
  2022.     b) Longword trackers.  These are utility.library compatible with one
  2023.     small exception: TAG_IGNORE, TAG_MORE and TAG_SKIP are not supported
  2024.     and they act as TAG_END.  The implementation is very simple: TAG_END
  2025.     ($00000000) is understood as a special SSLib tracker $0000 with the
  2026.     same meaning.  All other longword trackers start with $8000, which
  2027.     says that StartupInit has to fetch next word as tag ID and next
  2028.     longword as tag parameters (in case of string args, it's a pointer to
  2029.     the string).  The tag ID must be in range 8000-FFFF.
  2030.  
  2031.     c) Optional trackers (C000-FFFF).  These trackers have variable size
  2032.     of argument, but there's a simple mechanism to determine this size:
  2033.     it's encoded in bits #12 and #13 of tag ID: 00 means no parameters,
  2034.     01=one word, 10=one longword, 11=string (null-terminated and padded
  2035.     by zeroes to even length).  If one of these optional trackers is
  2036.     encountered and cannot be interpreted, it's simply skipped.
  2037.  
  2038.     d) Extended trackers (4000-7FFF).  Similar to Optional trackers, but
  2039.     can't be ignored.
  2040.  
  2041.     Many pointers in the tags are relative (marked as RelPtr).  They can
  2042.     be simply generated by the following macro:
  2043.  
  2044.     RelPtr    macro
  2045.     \@a    dc.w    \1-\@a
  2046.         endm
  2047.  
  2048.    INPUTS
  2049.     StartupStruct - pointer to startup structure (see StartupStruct in
  2050.         ss.i).    It consists of two words followed by the tags.    The
  2051.         first word contains requested size of user's variables and
  2052.         must be at least 4 (the first variable is always a pointer to
  2053.         base of ss.library).  The second one specifies which version
  2054.         of ss.library does the program require.
  2055.  
  2056.     WbMsg - pointer to WorkBench startup message (you must get it
  2057.         manually).  Can be any value when started from CLI.  Must be
  2058.         0 when started from process created by CreateProc, which is
  2059.         NOT started by the WorkBench.  This sounds very complicated -
  2060.         see the start macro in ssmac.h if you are confused.
  2061.  
  2062.    RESULT
  2063.     A5 points to the variable zone.  This value is required by all
  2064.     services of this library excluding where this doc says something
  2065.     other.    If you call SSLib with different value in A5, weird things
  2066.     can occur (and really occur).
  2067.  
  2068.    TAGS
  2069.     sst_finish - End of TagList.
  2070.  
  2071.     sst_wbconsole - Create console window if started from WB.  This
  2072.         window is used as standard input and output.
  2073.  
  2074.     sst_template (string,word) - Specifies argument template and offset
  2075.         from A5 to store the arguments on (see ParseArgs).
  2076.  
  2077.     sst_usertrk (RelPtr) - Defines user tracker types.  You pass a
  2078.         relative tointer to UserTrkTypes structure:
  2079.             DC.B  NumberOfTrackers,0
  2080.         followed by RelPtrs to freeing routines (see FreeObject).
  2081.  
  2082.     sst_extrahelp (string) - Defines extra help string for argument
  2083.         parsing.
  2084.  
  2085.     sst_exitrout (RelPtr) - Define exit routine, which will be called by
  2086.         ExitCleanup (or any error exit routine) before any cleanup is
  2087.         done.  This mechanism can be used for closing of windows and
  2088.         other similar actions.    The exit routine may call ExitCleanup
  2089.         and the error exit routines, in which case it won't be called
  2090.         again and may modify all registers except A5.  In case of
  2091.         fail during StartupInit, this routine is not called.
  2092.  
  2093.     sst_usererr (RelPtr) - Defines user's error routine.  This routine
  2094.         will be called by DisplayError and all error routines which
  2095.         display errors.  The routine will have the same parameters as
  2096.         DisplayError (A0=Message, A1=FormatData).  If this routine
  2097.         calls any of the error functions, it will be called again.
  2098.  
  2099.     sst_nowbstart - Exit with error message when called from WB.
  2100.  
  2101.     sst_library (string,WV,W) - Open library of specified name and
  2102.         version (WV), store its base to variable specified by its
  2103.         offset from A5 (W).  Exit with error message if can't be
  2104.         opened.
  2105.  
  2106.     sst_trylib (string,WV,W) - Try to open library (same function as
  2107.         previous tag, but if fails, the program will continue with
  2108.         base=0).
  2109.  
  2110.     sst_nowbargs - Don't parse WB arguments.
  2111.  
  2112.     sst_noprogname - Don't print program's name in error messages.
  2113.  
  2114.     sst_cputype (Min,Max) - Fail if CPU type isn't in specified range.
  2115.         0=68000...4=68040, -1=no upper limit
  2116.  
  2117.     sst_fputype (Min,-1) - Fail if FPU type isn't in specified range.
  2118.         0=none,1=68881,2=68882,3=68040
  2119.  
  2120.     sst_sysver (Min,Max) - Fail if kickstart version isn't in specified
  2121.         range.
  2122.  
  2123.     sst_errorreq - Forces using of requesters for error messages.
  2124.  
  2125.     sst_errors (BitMap.L) - Disable automatic processing of specified
  2126.         errors (see SS.i for constants (err_xxx)).
  2127.  
  2128.     sst_wbconname (string) - Use WB Console specified by name
  2129.  
  2130.     sst_envvar (string) - Try to fetch default values of parameters from
  2131.         given environment variable.  These parameters are overriden
  2132.         by values entered by the user.
  2133.  
  2134.     sst_poolsize (PoolSize.L) - Specify size of task's private memory
  2135.         pool.  This pool is used for allocation of all trackers.
  2136.         Default size = 512 bytes.  Specify higher values when using
  2137.         tracking very frequently.  This tag MUST be specified before
  2138.         all other tags.  The value must be an integer multiple of 8.
  2139.  
  2140.     sst_poolthresh (PoolThr.L) - Specify threshold of task's private
  2141.         memory pool (see TrackPool, PoolAlloc).  Default
  2142.         threshold=373.    Usage: rare.  This tag MUST be specified
  2143.         directly after sst_poolsize or at the start if there is no
  2144.         poolsize tag.
  2145.  
  2146.     sst_nostderr - Force stderr=stdout.  Don't open "*" for stderr.
  2147.  
  2148.     sst_noiconarg - don't pass names of multiselected icons as the first
  2149.         argument.  They will be simply ignored.
  2150.  
  2151.     sst_nocliargs - pass CLI argument line directly to your program
  2152.         without preprocessing of any kind.  If this tag is not
  2153.         specified and no template is given, all input arguments are
  2154.         discarded to prevent usual strange behaviour of standard
  2155.         buffered input.
  2156.  
  2157.    WARNING
  2158.     All registers excluding A4 and A6 are modified by this call.
  2159.  
  2160.    BUGS
  2161.     Argument parsing could be problematic when running from several
  2162.     debuggers (for example MonAm older than 3.04), because SSLib uses
  2163.     standard V37 way to pass them using buffered standard input.  See
  2164.     also ssmac.h for some workaround.  Also stderr may be incorrect in
  2165.     this case.  But this is NOT a bug in ss.library, it is a result of
  2166.     bugs in the debuggers.
  2167.  
  2168.    SEE ALSO
  2169.     ExitCleanup, ExitError
  2170.  
  2171. ss.library/StrCat                        ss.library/StrCat
  2172.  
  2173.    NAME
  2174.     StrCat -- Concatenate two strings.
  2175.  
  2176.    SYNOPSIS
  2177.     StrCat(Destination, Source);
  2178.            A0        A1
  2179.  
  2180.    FUNCTION
  2181.     This function performs usual string concatenation.
  2182.  
  2183.    INPUTS
  2184.     Destination - destination string
  2185.  
  2186.     Source - source string
  2187.  
  2188.    RESULT
  2189.     A0 contains address of the null character at the end of the
  2190.     destination string.  It allows to concatenate multiple strings
  2191.     without reloading of the destination pointer.
  2192.  
  2193. ss.library/StrToL                        ss.library/StrToL
  2194.  
  2195.    NAME
  2196.     StrToL -- Convert string to long integer number.
  2197.  
  2198.    SYNOPSIS
  2199.     Value, Position = StrToL(String);
  2200.     D0     D1         A0
  2201.  
  2202.    FUNCTION
  2203.     Convert string containing a number in ASCII form to binary form.
  2204.  
  2205.     It supports decimal, octal (prefixed by 0) and hexadecimal (prefixed
  2206.     by 0x or $) numbers.  All spaces before the number are skipped.
  2207.  
  2208.     If there're any invalid characters, the standard error mechanism is
  2209.     used.  If the user hadn't disabled it, the error message err_number
  2210.     is displayed and the program is terminated.
  2211.  
  2212.    INPUTS
  2213.     String - string to be converted
  2214.  
  2215.    RESULT
  2216.     Value - Value of number or 0 if invalid.
  2217.  
  2218.     Position (D1) - address of first invalid character if failed or zero
  2219.         if the input string contains valid number.
  2220.  
  2221. ss.library/TestBreak                     ss.library/TestBreak
  2222.  
  2223.    NAME
  2224.     TestBreak -- Test if the user has pressed break.
  2225.  
  2226.    SYNOPSIS
  2227.     TestBreak();
  2228.  
  2229.  
  2230.    FUNCTION
  2231.     Tests the CTRL-C signal and aborts the program if detected.  If the
  2232.     err_break bit is not set, this function only resets the break signal.
  2233.  
  2234.    NOTE
  2235.     Doesn't modify contents of D0,D1,A0,A1.
  2236.  
  2237.     Library base not needed in A6.
  2238.  
  2239.    SEE ALSO
  2240.     exec/SetSignal, arp/CheckAbort, arp/CheckBreak, dos.i
  2241.  
  2242. ss.library/TestStack                     ss.library/TestStack
  2243.  
  2244.    NAME
  2245.     TestStack -- Check stack overflow.
  2246.  
  2247.    SYNOPSIS
  2248.     TestStack();
  2249.  
  2250.  
  2251.    FUNCTION
  2252.     Test stack overflow and abort the program if it occured.
  2253.  
  2254.     The lowest possible value of SP is taken from sv_stklimit, which is
  2255.     initially set (by StartupInit) to TC_SPLOWER+128.
  2256.  
  2257.    NOTE
  2258.     Doesn't modify contents of D0,D1,A0,A1.
  2259.  
  2260.     Library base not needed in A6.
  2261.  
  2262.     The stack overflow error cannot be disabled.
  2263.  
  2264.    SEE ALSO
  2265.     TestBreak, StartupInit, ReportError
  2266.  
  2267. ss.library/TrackAlloc                    ss.library/TrackAlloc
  2268.  
  2269.    NAME
  2270.     TrackAlloc -- Allocate cleared memory and track it.
  2271.  
  2272.    SYNOPSIS
  2273.     MemBlock, Tracker = TrackAlloc(Size);
  2274.     D0      D1               D0
  2275.  
  2276.    FUNCTION
  2277.     Allocate, clear and track public memory of specified size.  If the
  2278.     memory is not available, exit with error message if its's enabled by
  2279.     the corresponding error bit.
  2280.  
  2281.     If you want to allocate large block of memory and you don't need it
  2282.     to be cleared, use TrackAllocPub(Size) instead.
  2283.  
  2284.    INPUTS
  2285.     Size - how large (in bytes) chunk of memory you want to allocate.
  2286.  
  2287.    RESULT
  2288.     MemBlock - pointer to allocated and cleared memory block or 0 if not
  2289.         enough memory and error processing is disabled.
  2290.  
  2291.     Tracker (D1) - object tracker - trk_data contains base address of the
  2292.         block (as returned in D0), trk_ext is set to block size.
  2293.  
  2294.    SEE ALSO
  2295.     TrackAllocMem, TrackAllocPub, FreeObject, exec/AllocMem
  2296.  
  2297. ss.library/TrackAllocMem                 ss.library/TrackAllocMem
  2298.  
  2299.    NAME
  2300.     TrackAllocMem -- Allocate memory and track it.
  2301.  
  2302.    SYNOPSIS
  2303.     MemBlock, Tracker = TrackAllocMem(Size, Requirements);
  2304.     D0      D1              D0    D1
  2305.  
  2306.    FUNCTION
  2307.     Allocate and track memory of specified size with specified
  2308.     attributes.  If the memory is not available, exit with error message
  2309.     if its's enabled by the corresponding error bit.
  2310.  
  2311.    INPUTS
  2312.     Size - how large (in bytes) chunk of memory you want to allocate.
  2313.  
  2314.     Requirements - memory requirements (as for AllocMem)
  2315.  
  2316.    RESULT
  2317.     MemBlock - pointer to allocated memory block 0 if not enough memory
  2318.         of required type and error processing is disabled.
  2319.  
  2320.     Tracker (D1) - object tracker - trk_data contains base address of the
  2321.         block (as returned in D0), trk_ext is set to block size.
  2322.  
  2323.    SEE ALSO
  2324.     TrackAlloc, TrackAllocPub, FreeObject, exec/AllocMem
  2325.  
  2326. ss.library/TrackAllocPub                 ss.library/TrackAllocPub
  2327.  
  2328.    NAME
  2329.     TrackAllocPub -- Allocate public memory and track it.
  2330.  
  2331.    SYNOPSIS
  2332.     MemBlock, Tracker = TrackAllocPub(Size);
  2333.     D0      D1              D0
  2334.  
  2335.    FUNCTION
  2336.     { no, this doesn't allocate a free place in a pub }
  2337.  
  2338.     Allocate region of public memory.  Doesn't perform any clearing!
  2339.  
  2340.     The exact memory attributes used are determined by the sv_memattr
  2341.     variable.  TrackAllocPub is an equivalent to TrackAllocMem
  2342.     (Size,sv_memattr).  This mechanism allows some standard functions
  2343.     which allocate public memory (LoadFile, TrackBufHandle etc) to use
  2344.     your own memory attributes instead of usual MEMF_PUBLIC.
  2345.  
  2346.    INPUTS
  2347.     Size - how large (in bytes) chunk of memory you want to allocate.
  2348.  
  2349.    RESULT
  2350.     MemBlock - pointer to allocated memory block or 0 if not enough
  2351.         memory and error processing is disabled.
  2352.  
  2353.     Tracker (D1) - object tracker - trk_data contains base address of the
  2354.         block (as returned in D0), trk_ext is set to block size.
  2355.  
  2356.    SEE ALSO
  2357.     TrackAllocMem, LoadFile, TrackBufHandle
  2358.  
  2359. ss.library/TrackBufHandle                ss.library/TrackBufHandle
  2360.  
  2361.    NAME
  2362.     TrackBufHandle -- Allocate and track handle for buffered I/O
  2363.  
  2364.    SYNOPSIS
  2365.     Handle = TrackBufHandle(Filename, OpenMode, BufSize);
  2366.     D0            A0      D0        D1
  2367.  
  2368.    FUNCTION
  2369.     Allocates a handle for buffered I/O and the I/O buffer associated
  2370.     with it.  The handle is initialized in the following way:
  2371.  
  2372.     - bh_handle = -1 (if it was 0, the tracker freeing routine wouldn't
  2373.       be called).
  2374.  
  2375.     - bh_name = the Filename parameter.
  2376.  
  2377.     - bh_readfunc, bh_writefunc and bh_seekfunc point to simple routine
  2378.       displaying alert AN_IONotSupported which is shown if someone
  2379.       doesn't initialize the routine pointers properly and tries to do
  2380.       I/O with them.
  2381.  
  2382.     - bh_bufsize = size of the buffer
  2383.  
  2384.     - bh_buffer = start of the buffer
  2385.  
  2386.     - bh_dataend = bh_buffer
  2387.  
  2388.     - bh_bufend = bh_buffer + bh_bufsize
  2389.  
  2390.     - bh_current = bh_buffer
  2391.  
  2392.     - bh_eofhook = pointer to RTS instruction (empty EOF hook)
  2393.  
  2394.     - bh_flags = flags set according to OpenMode (see ss.i)
  2395.  
  2396.     - bh_arg1 = bh_arg2 = 0
  2397.  
  2398.     If you want to do buffered I/O with this handle, set:
  2399.  
  2400.     - bh_handle = whatever you want (can be used by your block I/O
  2401.       subroutines)
  2402.  
  2403.     - bh_read = pointer to block read routine (only for read streams).
  2404.       The routine is called with A0 pointing to the handle, A1 saying
  2405.       where to load the block to, D0 containing the block length.  It
  2406.       should return D0=number of bytes read.
  2407.  
  2408.     - bh_write = pointer to block write routine (only for write streams).
  2409.       Called with parameters identical to those in bh_read, but doesn't
  2410.       return anything.
  2411.  
  2412.     - bh_seek = pointer to seek routine.  Called with A0=handle,
  2413.       D0=offset to seek to (absolute).  Result: none.
  2414.  
  2415.     - These block I/O routines are guaranteed to receive A4 and A5 from
  2416.       caller program.  In case of I/O error, they mustn't return
  2417.       (ExitError or something similar has to be called).
  2418.  
  2419.     - bh_arg1, bh_arg2 - set to anything you want (for use by your I/O
  2420.       routines)
  2421.  
  2422.     - bh_eofhook - set to your EOF hook if you need.  This hook will be
  2423.       called as soon as EOF will be encountered after reading of block by
  2424.       bh_readfunc.    To force normal EOF operation, the hook should return
  2425.       normally without changing ANY registers.  In other cases, it should
  2426.       call ExitError("Unexpected EOF") or something similar.
  2427.  
  2428.     If you want to associate the tracker of your I/O object with this
  2429.     handle tracker via the TrackSlave mechanism, you shouldn't use this
  2430.     one as a master, because trk_ext contains bh_name.
  2431.  
  2432.    INPUTS
  2433.     Filename - file name to be used in error reports.
  2434.  
  2435.     OpenMode - OPEN_OLD for read access, OPEN_NEW or OPEN_APPEND for
  2436.         write access.  OPEN_LINEBUF may be added (not ORed!) to
  2437.         obtain line buffering (buffers are flushed whenever the end
  2438.         of line character is written).
  2439.  
  2440.     BufSize - buffer size to be used.  May be zero to specify default
  2441.         buffer size (now 4K, may change in future versions).  Must be
  2442.         larger than 16 bytes and dividable by 4.
  2443.  
  2444.    RESULT
  2445.     Handle - buffered I/O handle (tracker).
  2446.  
  2447.    NOTE
  2448.     The functions for doing buffered I/O have slightly non-standard
  2449.     arguments - stream handle is passed in A2 for read streams and in A3
  2450.     for write streams.  If it's possible to use the function for both
  2451.     read and write streams, it comes in A2.  This strange behavior has
  2452.     been chosen to allow calling of long sequences of I/O calls without
  2453.     reloading the stream pointer.
  2454.  
  2455.     The stream tracker should be used the task which created it, because
  2456.     various things depend on caller's A5.
  2457.  
  2458.     The buffer itself is allocated via TrackAllocPub, therefore it's
  2459.     possible to specify your own memory requirements via sv_memattr
  2460.     (default is MEMF_PUBLIC).
  2461.  
  2462.    SEE ALSO
  2463.     TrackOpenBuf, B*, FreeObject
  2464.  
  2465. ss.library/TrackDevice                       ss.library/TrackDevice
  2466.  
  2467.    NAME
  2468.     TrackDevice -- Open device and track it.
  2469.  
  2470.    SYNOPSIS
  2471.     Error, Tracker, IORQ = TrackDevice(DevName, IORQ, Unit, Flags,
  2472.     D0     D1    A1           A0        A1      D0    D1
  2473.         ErrTable);
  2474.         A2
  2475.  
  2476.    FUNCTION
  2477.     Open device and track it.  In case of difficulty, write an error
  2478.     message and abort the program if requested by corresponding error
  2479.     bit.
  2480.  
  2481.    INPUTS
  2482.     DevName - device name, case-sensitive
  2483.  
  2484.     IORQ - IORequest to use with this device (if IORQ<256,
  2485.         TrackIoRq(0,IORQ) will be called to create new IORequest,
  2486.         which will be linked by TrackSlave to device's tracker).
  2487.  
  2488.     Unit - device unit number
  2489.  
  2490.     Flags - OpenDevice flags
  2491.  
  2492.     ErrTable - optional pointer to error message table (this pointer MUST
  2493.         be specified if you want to use ChkDoIO, but it may be NULL).
  2494.         The table is a sequence of error definition blocks terminated
  2495.         by a block of 0 errors (both Min and NumErr fields are zero).
  2496.         Each block starts with two words of data: the first one
  2497.         contains number of first error message in the block, the
  2498.         second one contains number error messages.  The header is
  2499.         followed by an array of longwords pointing to names of
  2500.         errors.
  2501.  
  2502.    RESULT
  2503.     Error - Error code or 0 if successful.
  2504.  
  2505.     Tracker (D1) - object tracker.    trk_data contains pointer to
  2506.         associated IoRequest structure, trk_sizeof[0] points to the
  2507.         error table (as given in A2).
  2508.  
  2509.     IORQ (A1) - copy of trk_data (pointer to associated IORequest)
  2510.  
  2511.    SEE ALSO
  2512.     ChkDoIO, TrackIORQ, TrackPort, FreeObject, exec/OpenDevice
  2513.  
  2514. ss.library/TrackDosObject                ss.library/TrackDosObject
  2515.  
  2516.    NAME
  2517.     TrackDosObject -- Allocate a dos object and track it.
  2518.  
  2519.    SYNOPSIS
  2520.     DosObject, Tracker = TrackDosObject(Type, TagList);
  2521.     D0       D1                D0      A0
  2522.  
  2523.    FUNCTION
  2524.     Allocate dos object and track it.  Does usual error handling and
  2525.     reporting (err_memory).
  2526.  
  2527.    INPUTS
  2528.     Type - dos object type
  2529.  
  2530.     TagList - dos object tag list
  2531.  
  2532.    RESULT
  2533.     DosObject - pointer to allocated dos object or 0 if not successful.
  2534.  
  2535.     Tracker (D1) - object tracker.    trk_data points to the object,
  2536.         trk_ext contains object type.
  2537.  
  2538.    SEE ALSO
  2539.     dos/AllocDosObject, FreeObject
  2540.  
  2541. ss.library/TrackExtd                     ss.library/TrackExtd
  2542.  
  2543.    NAME
  2544.     TrackExtd -- Create an extended tracker.
  2545.  
  2546.    SYNOPSIS
  2547.     Tracker, Tracker, TrkExt = TrackExtd(Type, ExtSize);
  2548.     D0     A0      A1             D0:8  D1
  2549.  
  2550.    FUNCTION
  2551.     Create an extended tracker structure and connect it to active
  2552.     resource list (if there's no resource list, one will be created).
  2553.  
  2554.     The extended tracker is a standard resource tracker, which has some
  2555.     additional data behind trk_sizeof.  These bytes are for your own use.
  2556.  
  2557.    INPUTS
  2558.     Type - tracker type (see ss.i)
  2559.  
  2560.     ExtSize - size of tracker extension block
  2561.  
  2562.    RESULT
  2563.     Tracker - pointer to newly created object tracker
  2564.  
  2565.     Tracker (A0) - pointer to the tracker
  2566.  
  2567.     TrkExt (A1) - pointer to trk_ext field of the tracker
  2568.  
  2569.    SEE ALSO
  2570.     TrackObject, FreeObject
  2571.  
  2572. ss.library/TrackIoRq                     ss.library/TrackIoRq
  2573.  
  2574.    NAME
  2575.     TrackIoRq -- Create an IoRequest and track it.
  2576.  
  2577.    SYNOPSIS
  2578.     IORQ, Tracker = TrackIoRq(OptionalPort, Size);
  2579.     D0    D1          A0        D0
  2580.  
  2581.    FUNCTION
  2582.     Create an IO Request and track it.  This function can use
  2583.     user-supplied message port or create special message port for this
  2584.     IORQ.  In case of difficulty, writes error message and aborts the
  2585.     program if requested by corresponding error bit.
  2586.  
  2587.    INPUTS
  2588.     OptionalPort - pointer to message port to be used as a reply port for
  2589.         the IoRequest.    If NULL, new port will be created including
  2590.         new signal.
  2591.  
  2592.     Size - size of the IoRequest or 0 for size of the IoExtStd structure.
  2593.  
  2594.    RESULT
  2595.     IORQ - pointer to newly created IoRequest structure.
  2596.  
  2597.     Tracker (D1) - obejct tracker.    trk_data points to the IoRequest
  2598.  
  2599.    SEE ALSO
  2600.     TrackPort, TrackDevice, FreeObject
  2601.  
  2602. ss.library/TrackLibrary                   ss.library/TrackLibrary
  2603.  
  2604.    NAME
  2605.     TrackLibrary -- Open a library and track it.
  2606.  
  2607.    SYNOPSIS
  2608.     Library, Tracker = TrackLibrary(LibName, Version);
  2609.     D0     D1            A0     D0
  2610.  
  2611.    FUNCTION
  2612.     Open library and track it.  If the library isn't available and you
  2613.     hadn't disabled it by the error bits, an error message will be
  2614.     displayed and the program will be aborted.
  2615.  
  2616.    INPUTS
  2617.     LibName - name of library, case is significant.
  2618.  
  2619.     Version - required minimal version (0=any).
  2620.  
  2621.    RESULT
  2622.     Library - pointer to library node or 0 if unsuccessful.
  2623.  
  2624.     Tracker (D1) - object tracker.    trk_data contains pointer to base of
  2625.         the library (as returned in D0).
  2626.  
  2627.    SEE ALSO
  2628.     FreeObject, StartupInit, exec/OpenLibrary
  2629.  
  2630. ss.library/TrackLinPool                   ss.library/TrackLinPool
  2631.  
  2632.    NAME
  2633.     TrackLinPool -- Create a linear memory pool and track it.
  2634.  
  2635.    SYNOPSIS
  2636.     LinPool = TrackLinPool(Quantum, Attributes);
  2637.     D0               D0    D1
  2638.  
  2639.    FUNCTION
  2640.     Create a linear memory pool and track it.
  2641.  
  2642.     Linear pooled allocation is an extremely fast memory allocation
  2643.     strategy designed for allocating of small blocks of memory, which are
  2644.     freed together.  The pool manager allocates memory in large blocks of
  2645.     given size (Quantum).  It tries to use currently active block for
  2646.     each allocation request.  If it fails, new block is created.
  2647.  
  2648.    INPUTS
  2649.     Quantum - allocation quantum
  2650.  
  2651.     Attributes - requested memory attributes (see AllocMem)
  2652.  
  2653.    RESULT
  2654.     LinPool - Pointer to linear memory pool tracker.
  2655.  
  2656.    SEE ALSO
  2657.     FreeObject, LinearAlloc, LinearAllocN
  2658.  
  2659. ss.library/TrackLock                     ss.library/TrackLock
  2660.  
  2661.    NAME
  2662.     TrackLock -- Lock dos object and track it.
  2663.  
  2664.    SYNOPSIS
  2665.     Lock, Tracker = TrackLock(Name, LockMode);
  2666.     D0    D1          A0    D0
  2667.  
  2668.    FUNCTION
  2669.     Lock dos object and track it.  Error handling as usually.
  2670.  
  2671.    INPUTS
  2672.     Name - name of the object you want to lock.  This pointer is stored
  2673.         in the tracker to be used later for reporting of errors,
  2674.         therefore you are not allowed to modify the name before
  2675.         freeing of the tracker.
  2676.  
  2677.     LockMode - lock mode (see dos.i)
  2678.  
  2679.    RESULT
  2680.     Lock - Dos lock or 0 if failed.
  2681.  
  2682.     Tracker (D1) - object tracker.    trk_data contains the lock, trk_ext
  2683.         points to the name.
  2684.  
  2685.    SEE ALSO
  2686.     dos/Lock, FreeObject
  2687.  
  2688. ss.library/TrackObject                       ss.library/TrackObject
  2689.  
  2690.    NAME
  2691.     TrackObject -- Create a standard tracker.
  2692.  
  2693.    SYNOPSIS
  2694.     Tracker, Tracker, TrkExt = TrackObject(Type);
  2695.     D0     A0      A1               D0:8
  2696.  
  2697.    FUNCTION
  2698.     Create a standard tracker and connect it to active resource list (if
  2699.     there's no resource list, new one will be created).
  2700.  
  2701.     This function is used to track objects of your own types defined
  2702.     using the UserTrkTypes structure (tracker types in range $80 to $FF)
  2703.     or to track objects defined by ss.library extensions (not implemented
  2704.     yet).
  2705.  
  2706.     Your object freeing function will be called ONLY if the trk_data
  2707.     field contains non-null value.    This suspiciously-looking rule allows
  2708.     you to track your objects simply with respect to all possible
  2709.     failures:
  2710.  
  2711.     - call TrackObject (if there isn't enough memory to do it -> aborted)
  2712.  
  2713.     - store A1
  2714.  
  2715.     - allocate your object
  2716.  
  2717.     - restore A1
  2718.  
  2719.     - store optional data at A1 if you need
  2720.  
  2721.     - store pointer to your object to -(A1)
  2722.  
  2723.     If allocation of your object fails and you abort the program, you
  2724.     don't have to free the tracker, because it will be done automatically
  2725.     by ExitCleanup (or other exit routine, which calls ExitCleanup) and
  2726.     your object-freeing routine won't be called.  If you don't abort the
  2727.     program, you have simply to free the tracker using FreeObject and
  2728.     your object-freeing routine won't be called, too.
  2729.  
  2730.    INPUTS
  2731.     Type - tracker type (as described in ss.i)
  2732.  
  2733.    RESULT
  2734.     Tracker - pointer to newly created object tracker
  2735.  
  2736.     Tracker (A0) - pointer to the tracker
  2737.  
  2738.     TrkExt (A1) - pointer to trk_ext field of the tracker
  2739.  
  2740.    NOTE
  2741.     There are some cases in which you want to suppress freeing of already
  2742.     tracked object (for example if you write some patch utility leaving
  2743.     patch code in memory after successful exit, but freeing it in case of
  2744.     failure).  It can be solved very simply by calling Remove(Tracker) -
  2745.     the tracker will be removed cleanly.  If you use this method,
  2746.     ExitCleanup will destroy the trackers themself (they are stored in a
  2747.     memory pool which is private to each task and is freed during the
  2748.     cleanup), but the tracked objects are not affected.  Do not call
  2749.     FreeObject on disconnected objects.
  2750.  
  2751.     Another way to do such a thing is to set Tracker.trk_type to
  2752.     trt_null, but it makes using of additional FreeObject() impossible,
  2753.     because it will free only the tracker, not the tracked object.
  2754.  
  2755.     You are not allowed to manipulate the positions of objects in the
  2756.     lists.    If you really need to do such a thing, use RelinkObject().
  2757.  
  2758.    SEE ALSO
  2759.     CreateResList, FreeObject, FreeResList, GetResList, TrackRoutine,
  2760.     TrackExtd, RelinkObject
  2761.  
  2762. ss.library/TrackOpen                     ss.library/TrackOpen
  2763.  
  2764.    NAME
  2765.     TrackOpen -- Open a file and track it
  2766.  
  2767.    SYNOPSIS
  2768.     FH, Tracker = TrackOpen(Name, OpenMode);
  2769.     D0  D1            A0    D0
  2770.  
  2771.    FUNCTION
  2772.     Open a file and track it.  Does usual error checking and handling
  2773.     (see some other tracking function).
  2774.  
  2775.    INPUTS
  2776.     Name - name of the file you want to open.  This pointer is stored in
  2777.         the tracker to be used later in error reports, therefore you
  2778.         are not allowed to modify the name until you free the
  2779.         tracker.
  2780.  
  2781.     OpenMode - Open() mode - see dos/dos.i - MODE_*.  You can also use
  2782.         one of SS open modes: OPEN_OLD (a synonym to MODE_OLDFILE,
  2783.         but slightly shorter value movable by MOVEQ), OPEN_NEW
  2784.         (identical to MODE_NEWFILE) or OPEN_APPEND (uses
  2785.         MODE_READWRITE and Seek() to EOF).
  2786.  
  2787.    RESULT
  2788.     FH - File handle or 0 if failed.
  2789.  
  2790.     Tracker (D1) - object tracker.    trk_data contains file handle,
  2791.         trk_ext points to file name.
  2792.  
  2793.    SEE ALSO
  2794.     dos/Open, dos.i, FreeObject
  2795.  
  2796. ss.library/TrackOpenBuf                   ss.library/TrackOpenBuf
  2797.  
  2798.    NAME
  2799.     TrackOpenBuf -- Open file for buffered I/O
  2800.  
  2801.    SYNOPSIS
  2802.     Handle = TrackOpenBuf(Filename, OpenMode, BufSize);
  2803.     D0              A0    D0      D1
  2804.  
  2805.    FUNCTION
  2806.     Obtains a buffered I/O handle via TrackBufHandle, opens a DOS file of
  2807.     given name and associates it with the handle.
  2808.  
  2809.    INPUTS
  2810.     Filename - name of the file you wish to open
  2811.  
  2812.     OpenMode - OPEN_OLD for read access, OPEN_NEW for write access to new
  2813.         file, OPEN_APPEND for appending to possibly existing file (if
  2814.         doesn't exist, it's created immediately).  OPEN_LINEBUF may
  2815.         be added (not ORed!) to request line buffering for
  2816.         interactive files (buffers are flushed whenever the end of
  2817.         line character is written).  If the file is not interactive,
  2818.         this flag is automatically reset.  If you want to do
  2819.         line-buffered I/O with non-interactive files, you should set
  2820.         the biob_linebuf bit in bh_flags after calling this function.
  2821.  
  2822.     BufSize - buffer size to be used.  May be zero to specify default
  2823.         buffer size (now 4K, may change in future versions).  Must be
  2824.         larger than 16 bytes and dividable by 4.
  2825.  
  2826.    RESULT
  2827.     Handle - buffered I/O handle (tracker).  May be used as a file
  2828.         tracker for ChkRead and similar functions.  NULL if opening
  2829.         failed and err_open is not set.
  2830.  
  2831.    NOTE
  2832.     If you want to do anything with the file handle returned in
  2833.     bh_handle, remember to call BFlush before and don't forget to update
  2834.     bh_position to reflect the changes you have made.
  2835.  
  2836.     When doing I/O, TestBreak is sometimes called automatically.
  2837.  
  2838.     The only fields in the handle you are allowed to modify are:
  2839.     bh_eofhook and bh_flags (but only the biob_linebuf bit in it) plus
  2840.     some other fields as shown in recommended inline versions of some I/O
  2841.     functions.
  2842.  
  2843.    WARNING
  2844.     The file I/O error bits (err_read, err_write and err_seek) _must_ be
  2845.     set for buffered I/O.  If it's needed to do some special error
  2846.     handling, call the whole sequence of I/O subroutines by CallBlock and
  2847.     test the errors by this way.
  2848.  
  2849.    SEE ALSO
  2850.     TrackBufHandle, B*, TrackOpen, FreeObject
  2851.  
  2852. ss.library/TrackOpenBufFH                ss.library/TrackOpenBufFH
  2853.  
  2854.    NAME
  2855.     TrackOpenBufFH -- Open a buffered I/O stream from given file handle
  2856.  
  2857.    SYNOPSIS
  2858.     Handle = TrackOpenBufFH(Filename, OpenMode, BufSize, FileHandle);
  2859.     D0            A0      D0        D1         D2
  2860.  
  2861.    FUNCTION
  2862.     Obtains a buffered I/O handle via TrackBufHandle and associates an
  2863.     already opened DOS file handle to it.
  2864.  
  2865.     For more information, see TrackOpenBuf.
  2866.  
  2867.    INPUTS
  2868.     Filename - file name used for error reports
  2869.  
  2870.     OpenMode - OPEN_OLD for read access, OPEN_NEW for write access to new
  2871.         file, OPEN_APPEND for appending at the end.  OPEN_LINEBUF may
  2872.         be added (not ORed!) to request line buffering for
  2873.         interactive files (buffers are flushed whenever the end of
  2874.         line character is written).  If the file is not interactive,
  2875.         this flag is automatically reset.  If you want to do
  2876.         line-buffered I/O with non-interactive files, you should set
  2877.         the biob_linebuf bit in bh_flags after calling this function.
  2878.  
  2879.     BufSize - buffer size to be used.  May be zero to specify default
  2880.         buffer size (now 4K, may change in future versions).  Must be
  2881.         larger than 16 bytes and dividable by 4.
  2882.  
  2883.     FileHandle - file handle to be used (will be stored in bh_handle).
  2884.  
  2885.    RESULT
  2886.     Handle - buffered I/O handle (tracker).  May be used as a file
  2887.         tracker for ChkRead and similar functions.  NULL if opening
  2888.         failed and err_open is not set.
  2889.  
  2890.    NOTE
  2891.     If you want to do anything with the file handle you have supplied,
  2892.     remember to call BFlush before and don't forget to update bh_position
  2893.     to reflect the changes you have made.
  2894.  
  2895.     When doing I/O, TestBreak is sometimes called automatically.
  2896.  
  2897.     The only fields in the handle you are allowed to modify are:
  2898.     bh_eofhook and bh_flags (but only the biob_linebuf bit in it) plus
  2899.     some other fields as shown in recommended inline versions of some I/O
  2900.     functions.
  2901.  
  2902.    SEE ALSO
  2903.     TrackOpenBuf, TrackBufHandle, FreeObject
  2904.  
  2905. ss.library/TrackPool                     ss.library/TrackPool
  2906.  
  2907.    NAME
  2908.     TrackPool -- Create private memory pool and track it.
  2909.  
  2910.    SYNOPSIS
  2911.     MemPool = TrackPool(Quantum, Threshold, Attributes);
  2912.     D0            D0         D1     D2
  2913.  
  2914.    FUNCTION
  2915.     Create a memory pool and track it.  Error checking is performed
  2916.     according to common rules (see elsewhere what does it mean).
  2917.  
  2918.     Pooled allocation is a relatively fast memory allocation strategy
  2919.     designed for manipulating small blocks of memory.  It's based on
  2920.     memory chunks, each of them has given size (Quantum).  Any memory
  2921.     block requested by PoolAlloc, which size is less or equal to
  2922.     Threshold, is allocated inside one of memory chunks.  Blocks greater
  2923.     than Threshold are allocated using standard AllocMem and linked to
  2924.     the pool.
  2925.  
  2926.     All memory blocks in the pool can be freed separately or
  2927.     simultaneously by FreeObject.
  2928.  
  2929.    INPUTS
  2930.     Quantum - allocation quantum
  2931.  
  2932.     Threshold - size of largest block allocated inside chunks
  2933.  
  2934.     Attributes - requested memory attributes (MEMF_#? - see AllocMem)
  2935.  
  2936.    RESULT
  2937.     MemPool - pointer to memory pool tracker
  2938.  
  2939.    SEE ALSO
  2940.     FreeObject, PoolAlloc, PoolFree, exec/AllocMem
  2941.  
  2942. ss.library/TrackPort                     ss.library/TrackPort
  2943.  
  2944.    NAME
  2945.     TrackPort -- Create a message port and track it.
  2946.  
  2947.    SYNOPSIS
  2948.     Port, Tracker = TrackPort();
  2949.     D0    D1
  2950.  
  2951.    FUNCTION
  2952.     Create a message port and track it.  Does usual error checking and
  2953.     handling.
  2954.  
  2955.    RESULT
  2956.     Port - pointer to newly created MsgPort structure.
  2957.  
  2958.     Tracker (D1) - object tracker.    trk_data points to the port.
  2959.  
  2960.    SEE ALSO
  2961.     exec/CreateMsgPort, FreeObject, TrackIORQ
  2962.  
  2963. ss.library/TrackRoutine                   ss.library/TrackRoutine
  2964.  
  2965.    NAME
  2966.     TrackRoutine -- Create tracker with custom freeing routine.
  2967.  
  2968.    SYNOPSIS
  2969.     Tracker = TrackRoutine(Routine, Args);
  2970.     D0               A0    A1
  2971.  
  2972.    FUNCTION
  2973.     Define a tracker, which will call your routine in time of freeing.
  2974.  
  2975.     The routine will be called with A0=Args, A2=Tracker.  routine.
  2976.  
  2977.     If args=0, no routine will be called.  For the reason of this
  2978.     suspicious action, see TrackObject (there are applied the same
  2979.     rules).
  2980.  
  2981.    INPUTS
  2982.     Routine - pointer to routine You wish to call.    The routine should
  2983.         leave intact all registers except D0-D1/A0-A1/A6.
  2984.  
  2985.     Args - user data passed to the routine in time of resource freeing.
  2986.  
  2987.    RESULT
  2988.     Tracker - tracker of expected type, trk_data contains routine
  2989.         pointer, trk_ext=args.
  2990.  
  2991.     A1 points to Args and can be used in similar way as in TrackObject,
  2992.     but you should use (A1) instead of -(A1).
  2993.  
  2994.    SEE ALSO
  2995.     TrackObject, FreeObject
  2996.  
  2997. ss.library/TrackSignal                       ss.library/TrackSignal
  2998.  
  2999.    NAME
  3000.     TrackSignal -- Allocate signal and track it.
  3001.  
  3002.    SYNOPSIS
  3003.     Signal, Tracker = TrackSignal();
  3004.     D0    D1
  3005.  
  3006.    FUNCTION
  3007.     Allocate a signal and track it.  Does usual error checking and
  3008.     handling.
  3009.  
  3010.    RESULT
  3011.     Signal - Number of signal or -1 if there are no free signals.
  3012.  
  3013.     Tracker (D1) - object tracker.    trk_data contains number of signal.
  3014.  
  3015.    SEE ALSO
  3016.     exec/AllocSignal, FreeObject
  3017.  
  3018. ss.library/TrackSlave                    ss.library/TrackSlave
  3019.  
  3020.    NAME
  3021.     TrackSlave -- Join two trackers.
  3022.  
  3023.    SYNOPSIS
  3024.     TrackSlave(Master, Slave);
  3025.            A0       A1
  3026.  
  3027.    FUNCTION
  3028.     Connect Slave to a list of Master's slaves and re-connect the Master
  3029.     to the front of current resource list, therefore it will be freed
  3030.     before the slaves.
  3031.  
  3032.     The linkage mechanism uses the Tracker.trk_ext field as pointer to
  3033.     the first slave.  It causes that standard trackers (excluding
  3034.     trt_null) cannot be used as masters.  The routine tracker (obtained
  3035.     via TrackRoutine) can be used, but its entry data (passed in A0 to
  3036.     user's resource freeing routine) will be overwritten (but it won't be
  3037.     0 in any case -> the routine is called everytime).
  3038.  
  3039.     The slaves are freed in LIFO order (the last slave will be freed as
  3040.     first).
  3041.  
  3042.    INPUTS
  3043.     Master - tracker to be used as the master
  3044.  
  3045.     Slave - tracker to be used as the slave
  3046.  
  3047.    SEE ALSO
  3048.     TrackObject, FreeObject
  3049.  
  3050.